-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
65 lines (51 loc) · 1.6 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
#Vars:
VANILLA=vanilla
MULTISTAGE=multistage
DISTROLESS=distroless
ALPINE=alpine
VERSION=1.0
APP_PORT=3000
HOST_PORT=${APP_PORT}
install:
cd app && npm install
run-app:
cd app && npm start
build-vanilla:
docker build --tag node-${VANILLA}:${VERSION} --file Dockerfile-${VANILLA} app
@echo
docker image ls node-${VANILLA}
run-vanilla: build-vanilla
@echo
docker run -p ${HOST_PORT}:${APP_PORT} -ti --rm --init node-${VANILLA}:${VERSION}
build-multistage:
docker build --tag node-${MULTISTAGE}:${VERSION} --file Dockerfile-${MULTISTAGE} app
@echo
docker image ls node-${MULTISTAGE}
run-multistage: build-multistage
@echo
docker run -p ${HOST_PORT}:${APP_PORT} -ti --rm --init node-${MULTISTAGE}:${VERSION}
build-distroless:
docker build --tag node-${DISTROLESS}:${VERSION} --file Dockerfile-${DISTROLESS} app
@echo
docker image ls node-${DISTROLESS}
run-distroless: build-distroless
@echo
docker run -p ${HOST_PORT}:${APP_PORT} -ti --rm --init node-${DISTROLESS}:${VERSION}
build-alpine:
docker build --tag node-${ALPINE}:${VERSION} --file Dockerfile-${ALPINE} app
@echo
docker image ls node-${ALPINE}
run-alpine: build-alpine
@echo
docker run -p ${HOST_PORT}:${APP_PORT} -ti --rm --init node-${ALPINE}:${VERSION}
test-app:
curl localhost:${HOST_PORT}
@echo;
all: build-vanilla build-multistage build-distroless build-alpine
@echo
@echo ">>> All images built: vanilla, multistage, distroless, alpine";echo
docker image ls -f "reference=node-*"
clean:
-rm -r ./app/node_modules
-docker image rm node-vanilla:${VERSION} node-multistage:${VERSION} \
node-distroless:${VERSION} node-alpine:${VERSION}