-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
104 lines (82 loc) · 2.4 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
SHELL := /bin/bash
#############
## Build ##
#############
docker-images-build:
docker image pull nginx:1-alpine
docker image pull python:3.6.5-slim
git clone https://github.com/ryan-blunden/learn-docker
cd learn-docker && "$(MAKE)" build
#
# [info] The following will generate errors you can safely ignore
#
-@rm -fr learn-docker
-@rmdir learn-docker /s /q
build: docker-images-build
docker-compose build ${ARGS}
check:
docker pull projectatomic/dockerfile-lint:latest
docker container run -it --rm --privileged \
-v "$(CURDIR)":/root/ \
-v "$(CURDIR)/docker":/usr/src/app/docker \
projectatomic/dockerfile-lint:latest dockerfile_lint \
-f /usr/src/app/docker/api/Dockerfile \
-f /usr/src/app/docker/frontend/Dockerfile \
##################
## Dev Server ##
##################
#
# Runs all required services in Docker, plus the docs, mail server and portainer.
#
app-dev-start:
docker-compose -f docker-compose.yml -f docker-compose-dev.yml up ${ARGS}
app-dev-stop:
docker-compose -f docker-compose.yml -f docker-compose-dev.yml stop
#########################
## Production Server ##
#########################
#
# Only starts the front-end and application server
#
app-start:
docker-compose up ${ARGS}
app-stop:
docker-compose stop
##########
## CI ##
##########
API_IMAGE=catswhocode/api
FRONTEND_IMAGE=catswhocode/frontend
BRANCH ?= $(shell git rev-parse --abbrev-ref HEAD)
COMMIT_SHA=$(shell git rev-parse --short HEAD)
build-front-end:
docker image build \
--build-arg GIT_BRANCH=$(BRANCH) \
--build-arg GIT_SHA=$(COMMIT_SHA) \
--build-arg VERSION=$(COMMIT_SHA) \
-t $(FRONTEND_IMAGE):latest \
-t $(FRONTEND_IMAGE):$(COMMIT_SHA) \
./docker/frontend
build-api:
docker image build \
--build-arg GIT_BRANCH=$(BRANCH) \
--build-arg GIT_SHA=$(COMMIT_SHA) \
--build-arg VERSION=$(COMMIT_SHA) \
-t $(API_IMAGE):latest \
-t $(API_IMAGE):$(COMMIT_SHA) \
-f docker/api/Dockerfile \
.
build: build-front-end build-api
docker-lint:
docker container run -it --rm --privileged \
-v "$(CURDIR)":/root/ \
-v "$(CURDIR)/docker":/usr/src/app/docker \
projectatomic/dockerfile-lint:latest dockerfile_lint \
-f $(DOCKERFILE)
validate:
"$(MAKE)" docker-lint DOCKERFILE=/usr/src/app/docker/api/Dockerfile
"$(MAKE)" docker-lint DOCKERFILE=/usr/src/app/docker/frontend/Dockerfile
"$(MAKE)" docker-lint DOCKERFILE=/usr/src/app/docker/docs/Dockerfile
test:
# TODO - Implement tests
artifact: