-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
31 lines (23 loc) · 1.08 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
.PHONY: build deploy image image-create image-finalize bundle
SERVICE=$(shell basename $(shell git rev-parse --show-toplevel))
REGISTRY=registry.openculinary.org
PROJECT=reciperadar
IMAGE_NAME=${REGISTRY}/${PROJECT}/${SERVICE}
IMAGE_COMMIT := $(shell git rev-parse HEAD)
IMAGE_TAG := $(strip $(if $(shell git status --porcelain --untracked-files=no), latest, ${IMAGE_COMMIT}))
build: image
deploy:
kubectl apply -f k8s
kubectl set image deployments -l app=${SERVICE} ${SERVICE}=${IMAGE_NAME}:${IMAGE_TAG}
image: image-create bundle image-finalize
image-create:
$(eval container=$(shell buildah from docker.io/library/nginx:alpine))
buildah copy $(container) 'etc/nginx/conf.d' '/etc/nginx/conf.d'
buildah run --network none $(container) -- rm -rf '/usr/share/nginx/html' --
image-finalize:
buildah copy $(container) 'public' '/usr/share/nginx/html'
buildah copy $(container) 'public/posts' '/usr/share/nginx/html'
buildah config --cmd '/usr/sbin/nginx -g "daemon off;"' --port 80 $(container)
buildah commit --quiet --rm --squash $(container) ${IMAGE_NAME}:${IMAGE_TAG}
bundle:
hugo