-
-
Notifications
You must be signed in to change notification settings - Fork 92
/
Dockerfile.debian
90 lines (70 loc) · 2.29 KB
/
Dockerfile.debian
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
########
# BASE
########
FROM node:18-bookworm-slim AS base
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=1
WORKDIR /usr/app
########
# DEPS
########
FROM base AS deps
# The Google Chrome apt list only seems to provide the latest version, so version compatibility with puppeteer is questionable
RUN apt-get update \
&& apt-get install -y wget gnupg procps \
&& wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - \
&& sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
google-chrome-stable \
fonts-ipafont-gothic \
fonts-wqy-zenhei \
fonts-thai-tlwg \
fonts-kacst \
fonts-freefont-ttf \
libxss1 \
# App dependencies
jq \
tzdata \
cron \
tini \
&& rm -rf /var/lib/apt/lists/*
########
# 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=""
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-bookworm-slim" \
org.opencontainers.image.version="debian"
ENV NODE_ENV=production \
PUPPETEER_EXECUTABLE_PATH=/usr/bin/google-chrome-stable \
COMMIT_SHA=${COMMIT_SHA} \
BRANCH=${BRANCH}
EXPOSE 3000
VOLUME [ "/usr/app/config" ]
ENTRYPOINT ["tini", "--", "docker-entrypoint.sh"]