-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathdocker.include.mk
67 lines (60 loc) · 1.92 KB
/
docker.include.mk
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
# this file is included when MODE is set to 'docker' in makefile
ifndef REGISTRY # ensure REGISTRY in env is prioritised over default
REGISTRY := $(shell docker info -f '{{.IndexServerAddress}}'|awk -F[/:] '{print $$4}')# default is index.docker.io
endif
CNTNAME := docker_mkdocsmaterial
IMAGETAG := $(REGISTRY)/woahbase/alpine-mkdocsmaterial:9.6.12
PUID := $(shell id -u)
PGID := $(shell id -g)
RUNFLAGS := \
--hostname mkdocsmaterial \
--name $(CNTNAME) \
--workdir /home/alpine/project \
-c 512 -m 256m \
-e PGID=$(PGID) -e PUID=$(PUID) \
-p $(PORT):$(PORT) \
-v $(CURDIR):/home/alpine/project \
-v /etc/hosts:/etc/hosts:ro \
-v /etc/localtime:/etc/localtime:ro \
#
# run: CMD = e.g build or serve
run: ## run with docker
docker run --rm -i \
$(RUNFLAGS) \
$(IMAGETAG) \
mkdocs $(CMD)
shell: ## get a shell with docker
docker run --rm -it \
$(RUNFLAGS) \
$(IMAGETAG) \
bash
test: build ## test static site with nginx
docker run --rm \
--name docker_nginx \
-e PGID=$(PGID) \
-e PUID=$(PUID) \
-p 80:80 \
-p 443:443 \
-v $(CURDIR)/site:/config/www \
$(REGISTRY)/woahbase/alpine-nginx
deploy_netlify: ## deploy site to netlify (as draft unless $(PROD) is set)
docker run --rm \
--name docker_netlify \
--workdir /home/alpine/project \
-c 512 \
-m 768m \
-e NETLIFY_AUTH_TOKEN=$(if $(NETLIFY_AUTH_TOKEN),$(NETLIFY_AUTH_TOKEN),$(error NETLIFY_AUTH_TOKEN is not defined)) \
-e NETLIFY_SITE_ID=$(if $(NETLIFY_SITE_ID),$(NETLIFY_SITE_ID),$(error NETLIFY_SITE_ID is not defined)) \
-e PGID=$(PGID) \
-e PUID=$(PUID) \
-e S6_NPM_LOCAL_PACKAGES=netlify-cli \
-e S6_NPM_PROJECTDIR=/home/alpine/project \
-v $(CURDIR):/home/alpine/project \
$(REGISTRY)/woahbase/alpine-nodejs \
netlify \
--telemetry-disable \
deploy \
--dir=site \
--$(if $(PROD),prod,alias="draft-$${BUILDNUMBER:-manual}") \
--message "Buildbot deploy $${BUILDNUMBER:-undefined}-$(shell date -u +%Y%m%d)" \
#