-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
94 lines (74 loc) · 2.39 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
88
89
90
91
92
93
94
########
# BASE
########
FROM node:16-bullseye-slim as base
WORKDIR /usr/app
########
# DEPS
########
FROM base as deps
RUN echo "deb http://deb.debian.org/debian bullseye main contrib non-free" > /etc/apt/sources.list \
&& echo "deb http://deb.debian.org/debian-security/ bullseye-security main contrib non-free" >> /etc/apt/sources.list \
&& echo "deb http://deb.debian.org/debian bullseye-updates main contrib non-free" >> /etc/apt/sources.list \
&& echo "ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true" | debconf-set-selections \
&& apt-get update \
&& apt-get install -y \
# fonts
fonts-arphic-ukai \
fonts-arphic-uming \
fonts-ipafont-mincho \
fonts-thai-tlwg \
fonts-kacst \
fonts-ipafont-gothic \
fonts-unfonts-core \
ttf-wqy-zenhei \
ttf-mscorefonts-installer \
fonts-freefont-ttf \
# app
tini \
&& apt-get clean \
&& apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/*
# Copy package.json for version number
COPY package*.json ./
RUN npm ci --only=production && $(npx install-browser-deps) \
# Heavy inspiration from: https://github.com/ulixee/hero/blob/main/Dockerfile
&& groupadd -r csgosus \
&& useradd -r -g csgosus -G audio,video csgosus \
&& mkdir -p /home/csgosus/Downloads \
&& mkdir -p /home/csgosus/.cache \
&& chown -R csgosus:csgosus /home/csgosus \
&& mv ~/.cache/ulixee /home/csgosus/.cache/ \
&& chmod 777 /tmp
# && chmod -R 777 /home/csgosus/.cache/ulixee
########
# 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
# Add below to run as unprivileged user.
USER csgosus
# Steal compiled code from build image
COPY --from=build /usr/app/dist ./dist
LABEL org.opencontainers.image.title="csgo-sus" \
org.opencontainers.image.url="https://github.com/claabs/csgo-sus" \
org.opencontainers.image.description="Lookup in-depth public data on CSGO players' accounts to see if they're suspicious" \
org.opencontainers.image.name="csgo-sus" \
org.opencontainers.image.base.name="node:16-bullseye-slim"
ARG COMMIT_SHA=""
ENV NODE_ENV=production \
CACHE_DIR=/csgo-sus \
COMMIT_SHA=${COMMIT_SHA}
VOLUME [ "/csgo-sus" ]
ENTRYPOINT ["tini", "--"]
CMD ["node", "dist/index.js"]