forked from matrix-discord/mx-puppet-discord
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
64 lines (49 loc) · 1.51 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
FROM node:alpine AS builder
WORKDIR /opt/mx-puppet-discord
# run build process as user in case of npm pre hooks
# pre hooks are not executed while running as root
RUN chown node:node /opt/mx-puppet-discord
RUN apk --no-cache add git python make g++ pkgconfig \
build-base \
cairo-dev \
jpeg-dev \
pango-dev \
musl-dev \
giflib-dev \
pixman-dev \
pangomm-dev \
libjpeg-turbo-dev \
freetype-dev
RUN wget -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub && \
wget -O glibc-2.32-r0.apk https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk && \
apk add glibc-2.32-r0.apk
COPY package.json package-lock.json ./
RUN chown node:node package.json package-lock.json
USER node
RUN npm install
COPY tsconfig.json ./
COPY src/ ./src/
RUN npm run build
FROM node:alpine
VOLUME /data
ENV CONFIG_PATH=/data/config.yaml \
REGISTRATION_PATH=/data/discord-registration.yaml
# su-exec is used by docker-run.sh to drop privileges
RUN apk add --no-cache su-exec \
cairo \
jpeg \
pango \
musl \
giflib \
pixman \
pangomm \
libjpeg-turbo \
freetype
WORKDIR /opt/mx-puppet-discord
COPY docker-run.sh ./
COPY --from=builder /opt/mx-puppet-discord/node_modules/ ./node_modules/
COPY --from=builder /opt/mx-puppet-discord/build/ ./build/
# change workdir to /data so relative paths in the config.yaml
# point to the persisten volume
WORKDIR /data
ENTRYPOINT ["/opt/mx-puppet-discord/docker-run.sh"]