-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
45 lines (38 loc) · 1.1 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
# http://clarkgrubb.com/makefile-style-guide
MAKEFLAGS += --warn-undefined-variables
SHELL := bash
.SHELLFLAGS := -eu -o pipefail -c
.DEFAULT_GOAL := all
.DELETE_ON_ERROR:
.SUFFIXES:
NAME ?= nginx-s3-proxy
IMAGE := nginx-s3-proxy
IMAGE_LE := $(IMAGE)-letsencrypt
VERSION ?= latest
BUILD_TARGET := prod
RUNARGS := -d --name $(NAME)
RUNARGS_TLS := -v /etc/letsencrypt:/etc/letsencrypt:ro \
-v /etc/ssl/dhparam.pem:/etc/ssl/dhparam.pem:ro
ifdef DEBUG
RUNARGS := -it --rm --name $(NAME)
endif
ifdef LETSENCRYPT
IMAGE := $(IMAGE_LE)
BUILD_TARGET := letsencrypt
RUNARGS_TLS := $(subst letsencrypt:ro,letsencrypt:rw,$(RUNARGS_TLS))
RUNARGS := $(RUNARGS) -e LETSENCRYPT=1
endif
ifeq ($(ENV), prod)
RUNARGS := $(RUNARGS) $(RUNARGS_TLS) -e ENV=prod \
-p '0.0.0.0:80:80' -p '0.0.0.0:443:443' --network=host
else
RUNARGS := $(RUNARGS) -p '127.0.0.1:8000:80'
endif
.PHONY: image
image:
podman build --target $(BUILD_TARGET) -t imiric/$(IMAGE):$(VERSION) .
.PHONY: run
run:
podman run $(RUNARGS) \
-v $(CURDIR)/secrets.env:/run/secrets/secrets.env \
imiric/$(IMAGE):$(VERSION)