Added --user to 'docker run', cleaned up Docker vars in Makefile
This commit is contained in:
16
Makefile
16
Makefile
@@ -8,7 +8,12 @@ DOCKER_IMAGE_NAME=bdebyl/hugo
|
|||||||
DOCKER_IMAGE_TAG=0.2
|
DOCKER_IMAGE_TAG=0.2
|
||||||
DOCKER_IMAGE=$(DOCKER_IMAGE_NAME):$(DOCKER_IMAGE_TAG)
|
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
|
# Look up CloudFront distribution ID based on website alias
|
||||||
DISTRIBUTION_ID=$(shell aws cloudfront list-distributions \
|
DISTRIBUTION_ID=$(shell aws cloudfront list-distributions \
|
||||||
@@ -16,10 +21,13 @@ DISTRIBUTION_ID=$(shell aws cloudfront list-distributions \
|
|||||||
--output text)
|
--output text)
|
||||||
|
|
||||||
build:
|
build:
|
||||||
$(DOCKER_RUN) $(DOCKER_IMAGE)
|
$(DOCKER_RUN)
|
||||||
|
|
||||||
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:
|
||||||
@# Clean up existing generated site
|
@# Clean up existing generated site
|
||||||
@@ -31,7 +39,7 @@ deploy: clean build
|
|||||||
|
|
||||||
cache:
|
cache:
|
||||||
@# Invalidate caches
|
@# 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)
|
# Default target for make (<=3.80)
|
||||||
.PHONY: build run deploy
|
.PHONY: build run deploy
|
||||||
|
|||||||
Reference in New Issue
Block a user