-
-
Notifications
You must be signed in to change notification settings - Fork 93
/
Dockerfile
85 lines (64 loc) · 2.25 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
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
########
# BASE
########
FROM node:18-alpine3.20 AS base
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
WORKDIR /usr/app
########
# DEPS
########
FROM base AS deps
# Go to https://hub.docker.com/_/node/ and note the latest stable Alpine version available (e.g. alpine3.19).
# Go to https://pkgs.alpinelinux.org/package/v3.20/community/x86_64/chromium (replace with the latest Alpine version)
# and note the Chromium version available. Then go to https://pptr.dev/chromium-support
# and find the latest version that supports that Chromium version, and update it in the package.json.
RUN apk add --no-cache \
'chromium=~130' \
ca-certificates \
ttf-freefont \
# App dependencies
jq \
tzdata \
tini
########
# BUILD
########
FROM base AS build
# Copy all source files
COPY package*.json tsconfig.json ./
# Add dev deps
RUN npm ci
# Copy source code
COPY src src
RUN npm run build
########
# DEPLOY
########
FROM deps AS deploy
# Copy package.json for version number
COPY package*.json ./
RUN npm ci --omit=dev
# Steal compiled code from build image
COPY --from=build /usr/app/dist ./dist
COPY entrypoint.sh /usr/local/bin/docker-entrypoint.sh
# backwards compat (from https://success.docker.com/article/use-a-script-to-initialize-stateful-container-data)
RUN ln -s /usr/local/bin/docker-entrypoint.sh /
ARG COMMIT_SHA="" \
BRANCH=""
# Put COMMIT_SHA in a file, since Docker managers like Portainer will not use updated ENVs
RUN echo $COMMIT_SHA > commit-sha.txt && echo $BRANCH > branch.txt
LABEL org.opencontainers.image.title="epicgames-freegames-node" \
org.opencontainers.image.url="https://github.com/claabs/epicgames-freegames-node" \
org.opencontainers.image.description="Automatically redeem free games promotions on the Epic Games store" \
org.opencontainers.image.name="epicgames-freegames-node" \
org.opencontainers.image.revision=${COMMIT_SHA} \
org.opencontainers.image.ref.name=${BRANCH} \
org.opencontainers.image.base.name="node:18-alpine3.19" \
org.opencontainers.image.version="latest"
ENV NODE_ENV=production \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser \
COMMIT_SHA=${COMMIT_SHA} \
BRANCH=${BRANCH}
EXPOSE 3000
VOLUME [ "/usr/app/config" ]
ENTRYPOINT ["tini", "--", "docker-entrypoint.sh"]