forked from claabs/epicgames-freegames-node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
87 lines (67 loc) · 2.28 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
86
87
########
# BASE
########
FROM node:16-alpine3.15 as base
ENV DISTRO=alpine
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
WORKDIR /usr/app
########
# DEPS
########
FROM base as deps
# Chromium dependencies https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md#running-on-alpine
# To find latest chromium version for puppeteer, go to https://github.com/puppeteer/puppeteer/blob/v13.4.0/src/revisions.ts,
# select the correct tag for the puppeteer version, and note the chromium revision number. Then go
# to https://omahaproxy.appspot.com/ and in "Find Releases" search for "r<version number>". Then
# ensure that version is published at https://pkgs.alpinelinux.org/package/v3.15/community/x86_64/chromium
RUN apk add --no-cache \
'chromium=~99' \
nss \
freetype \
harfbuzz \
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 --only=production
# 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=""
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:16-alpine3.15" \
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"]