-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
82 lines (75 loc) · 2.92 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
SHELL=/bin/bash
include .env
LAST_ALPINE_VER != grep -oP '^FROM alpine:\K[\d\.]+' Dockerfile | head -1
# Release links
# https://wiki.alpinelinux.org/wiki/Alpine_Linux:Releases
# https://github.com/nginx/nginx/releases/
# https://github.com/openssl/openssl/releases
# https://www.pcre.org/ - always uses 8.3
# https://www.zlib.net/ - 1.2.11 rare updates
.PHONY: build
build: bld
@#export DOCKER_BUILDKIT=1;
@docker buildx build --output "type=image,push=false" \
--tag $(DOCKER_IMAGE):$(NGINX_VER) \
--tag docker.pkg.github.com/$(REPO_OWNER)/$(REPO_NAME)/$(PROXY_CONTAINER_NAME):$(PROXY_VER) \
--build-arg PREFIX='$(NGINX_HOME)' \
--build-arg NGINX_VER='$(NGINX_VER)' \
--build-arg ZLIB_VER='$(ZLIB_VER)' \
--build-arg PCRE_VER='$(PCRE_VER)' \
--build-arg OPENSSL_VER='$(OPENSSL_VER)' \
--build-arg ECHO_VER='$(ECHO_VER)' \
--build-arg HEADERS_MORE_VER='$(HEADERS_MORE_VER)' \
--build-arg NGX_DEVEL_KIT='$(NGX_DEVEL_KIT)' \
--build-arg SET_MISC_VER='$(SET_MISC_VER)' \
--build-arg FORM_INPUT_VER='$(FORM_INPUT_VER)' \
--build-arg COOKIE_FLAG_VER='$(COOKIE_FLAG_VER)' \
.
.PHONY: bld
bld:
@echo '$(DOCKER_IMAGE)'
@#export DOCKER_BUILDKIT=1;
@echo 'LAST ALPINE VERSION: $(LAST_ALPINE_VER) '
@if [[ '$(LAST_ALPINE_VER)' = '$(FROM_ALPINE_TAG)' ]] ; then \
echo 'FROM_ALPINE_TAG: $(FROM_ALPINE_TAG) ' ; else \
echo ' - updating Dockerfile to Alpine tag: $(FROM_ALPINE_TAG) ' && \
sed -i 's/alpine:$(LAST_ALPINE_VER)/alpine:$(FROM_ALPINE_TAG)/g' Dockerfile && \
docker pull alpine:$(FROM_ALPINE_TAG) ; fi
@docker buildx build --output "type=image,push=false" \
--target=$@ \
--tag='$(DOCKER_IMAGE):$(@)-$(NGINX_VER)' \
--build-arg PREFIX='$(NGINX_HOME)' \
--build-arg NGINX_VER='$(NGINX_VER)' \
--build-arg ZLIB_VER='$(ZLIB_VER)' \
--build-arg PCRE_VER='$(PCRE_VER)' \
--build-arg OPENSSL_VER='$(OPENSSL_VER)' \
--build-arg ECHO_VER='$(ECHO_VER)' \
--build-arg HEADERS_MORE_VER='$(HEADERS_MORE_VER)' \
--build-arg NGX_DEVEL_KIT='$(NGX_DEVEL_KIT)' \
--build-arg SET_MISC_VER='$(SET_MISC_VER)' \
--build-arg FORM_INPUT_VER='$(FORM_INPUT_VER)' \
--build-arg COOKIE_FLAG_VER='$(COOKIE_FLAG_VER)' \
.
dkrStatus != docker ps --filter name=orMin --format 'status: {{.Status}}'
dkrPortInUse != docker ps --format '{{.Ports}}' | grep -oP '^(.+):\K(\d{4})' | grep -oP "80"
dkrNetworkInUse != docker network list --format '{{.Name}}' | grep -oP "$(NETWORK)"
.PHONY: run
run:
@$(if $(dkrNetworkInUse),echo '- NETWORK [ $(NETWORK) ] is available',docker network create $(NETWORK))
@$(if $(dkrPortInUse), echo '- PORT [ 80 ] is already taken';false , echo '- PORT [ 80 ] is available')
@docker run --rm \
--name min \
--publish 80:80 \
--network $(NETWORK) \
--detach \
docker.pkg.github.com/$(REPO_OWNER)/$(REPO_NAME)/$(PROXY_CONTAINER_NAME):$(PROXY_VER)
@sleep 3
@docker ps
.PHONY: run-bld
run-bld:
@docker run -it --rm \
--name bld \
$(DOCKER_IMAGE):bld-$(NGINX_VER)
.PHONY: stop
stop:
@docker stop min