Browse Source

Update the build process

keycloak-part-2
Hannes Körber 10 months ago
parent
commit
b6f67693c1
Signed by: hannes GPG Key ID: CD28A7CC31318017
  1. 2
      Dockerfile.nginx
  2. 66
      Makefile

2
Dockerfile → Dockerfile.nginx

@ -1,3 +1,3 @@
FROM nginx:1.12.2-alpine
FROM nginx:1.18.0
ADD public/ /usr/share/nginx/html/

66
Makefile

@ -2,38 +2,60 @@ REGISTRY := registry.hkoerber.de
APPNAME := blog
PUSHURL := $(REGISTRY)/$(APPNAME)
RESUME := static/assets/resume/resume.pdf
RESUME := static/assets/resume/Hannes_Koerber_Resume.pdf
RESUME_HTML := static/assets/resume-html
.PHONY: all
all: | build image image-push
.PHONY: contrib-resume
contrib-resume:
$(MAKE) -C contrib/resume resume.pdf
.PHONY: resume
resume:
(cd contrib/resume && $(MAKE) pdf)
.PHONY: contrib-resume-html
contrib-resume-html:
$(MAKE) -C contrib/resume html-out/index.html
$(RESUME): contrib-resume
cp contrib/resume/resume.pdf $(RESUME)
$(RESUME_HTML): contrib-resume-html
cp -r contrib/resume/html-out static/assets/resume-html
.PHONY: assets
assets: resume
assets: $(RESUME) $(RESUME_HTML)
.PHONY: build
build:
bundle exec jekyll build --config=./_config.yml,./_config.$(TARGET).yml
build-production: assets
git diff-index --quiet HEAD || { echo >&2 "Local changes, refusing to build" ; exit 1 ; }
docker run \
--rm \
--net host \
-v $(PWD):/workdir \
-w /workdir \
registry.hkoerber.de/hugo:f216de6b127620641bcaf1d28fe16bf1ea2db884 \
/app/bin/hugo \
--baseURL=https://blog.hkoerber.de/ \
--cleanDestinationDir \
--minify \
--destination ./public/
sudo chown -R $(shell id -u):$(shell id -g) ./public
sudo chmod -R o+rX ./public
.PHONY: image
image:
image-production: build-production
git diff-index --quiet HEAD || { echo >&2 "Local changes, refusing to build" ; exit 1 ; }
docker build \
--tag $(REGISTRY)/$(APPNAME) \
--tag $(REGISTRY)/$(APPNAME):$${DRONE_COMMIT_BRANCH} \
--tag $(REGISTRY)/$(APPNAME):$${DRONE_COMMIT_SHA} \
-f Dockerfile .
.PHONY: image-push
push:
docker push $(PUSHURL)
.PHONY: develop
develop:
bundle exec jekyll serve . --incremental
--file ./Dockerfile.nginx \
--tag $(REGISTRY)/$(APPNAME):latest \
--tag $(REGISTRY)/$(APPNAME):$(shell git rev-parse HEAD) \
.
.PHONY: push-production
push-production: image-production
docker push $(REGISTRY)/$(APPNAME):latest
docker push $(REGISTRY)/$(APPNAME):$(shell git rev-parse HEAD)
.PHONY: release
release: push-production
.PHONY: preview
preview: assets

Loading…
Cancel
Save