forked from czechitas/java-web
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
23 lines (16 loc) · 1006 Bytes
/
Makefile
File metadata and controls
23 lines (16 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
.PHONY: help build watch
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
IMAGE_NAME=czechitas-web-java-1
NGINX_IMAGE_NAME="$(IMAGE_NAME)-nginx"
help: ## Print this help message.
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
build: ## Build the docker image Jekyll Blog
docker build -t $(IMAGE_NAME) .
run: build ## Run the build Jekyll blog server
docker run -d -p 80:80 $(IMAGE_NAME)
stop: ## Stop Jekyll Blog server
docker stop `docker ps -a -q --filter ancestor=$(IMAGE_NAME) --format="{{.ID}}"`
watch: ## Continuous build with running Jekyll server
docker build --target builder -t $(IMAGE_NAME) .
docker run --rm -d -p 80:80 -v '$(ROOT_DIR)/docs/_site/:/usr/share/nginx/html' --name $(NGINX_IMAGE_NAME) nginx
docker run --rm -v "$(ROOT_DIR)/docs:/src" -w /src "$(IMAGE_NAME):latest" bash -c 'bundle install --path /src/../vendor/bundle && bundle exec jekyll build --watch'