-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathDockerfile
56 lines (35 loc) · 1 KB
/
Dockerfile
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
# syntax=docker/dockerfile:1
FROM node:22-alpine as v1
# default version for latest and v1 tags. No healthcheck and version set to v1
ARG NODE_ENV=production
ENV NODE_ENV=$NODE_ENV \
PORT=80 \
VERSION=v1 \
FAIL_STARTUP=false \
DELAY_STARTUP=0 \
DELAY_HEALTHCHECK=0 \
HAPPYHEALTHCHECK=true \
ENABLE_LOGGER=true
RUN apk add --no-cache curl
WORKDIR /opt
COPY package.json package-lock.json* ./
RUN npm install && npm cache clean --force
ENV PATH /opt/node_modules/.bin:$PATH
WORKDIR /opt/app
COPY . /opt/app
# NO HEALTHCHECK
CMD [ "node", "app.js" ]
FROM v1 as v1-healthcheck
# check every 5s to ensure this service returns HTTP 200
HEALTHCHECK --interval=5s --timeout=3s --start-period=10s --retries=3 \
CMD curl -fs http://localhost:$PORT/healthz || exit 1
FROM v1 as v2
ENV VERSION=v2
FROM v1-healthcheck as v2-healthcheck
ENV VERSION=v2
FROM v1 as v3
ENV VERSION=v3 \
FAIL_STARTUP=true
FROM v1-healthcheck as v3-healthcheck
ENV VERSION=v3 \
HAPPYHEALTHCHECK=false