diff --git a/Makefile b/Makefile index 4dab30e..fdd13f9 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,12 @@ DOCKER_IMAGE_NAME=bdebyl/hugo DOCKER_IMAGE_TAG=0.2 DOCKER_IMAGE=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG) -DOCKER_RUN=docker run --rm -v $(shell pwd):/src -p 127.0.0.1:1313:1313/tcp +# Container Variables +RUN_USER=--user $(shell id -u $$USER):$(shell id -g $$USER) +RUN_VOL=-v $(shell pwd):/src +RUN_PORT=-p 1313:1313/tcp + +DOCKER_RUN=docker run -it --rm ${RUN_USER} ${RUN_VOL} ${RUN_PORT} ${DOCKER_IMAGE} # Look up CloudFront distribution ID based on website alias DISTRIBUTION_ID=$(shell aws cloudfront list-distributions \ @@ -16,10 +21,13 @@ DISTRIBUTION_ID=$(shell aws cloudfront list-distributions \ --output text) build: - $(DOCKER_RUN) $(DOCKER_IMAGE) + $(DOCKER_RUN) run: - $(DOCKER_RUN) $(DOCKER_IMAGE) server --bind=0.0.0.0 + $(DOCKER_RUN) server --bind=0.0.0.0 + +new: + $(DOCKER_RUN) new post/$(shell read -p "Post Name (i.e. my_post.md): " pn; echo $$pn) clean: @# Clean up existing generated site @@ -31,7 +39,7 @@ deploy: clean build cache: @# Invalidate caches - aws cloudfront create-invalidation --distribution-id $(DISTRIBUTION_ID) --paths '/*' + aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --paths '/*' # Default target for make (<=3.80) .PHONY: build run deploy