forked from timvisee/send
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
63 lines (47 loc) · 1.29 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
##
# Send
#
# License https://gitlab.com/timvisee/send/blob/master/LICENSE
##
# Build project
FROM node:18.8-alpine3.15 AS base
ENV HUSKY=0
ENV npm_config_audit=false
ENV npm_config_fund=false
ENV npm_config_update_notifier=false
RUN set -x \
# Change node uid/gid
&& apk --no-cache add shadow \
&& groupmod -g 1001 node \
&& usermod -u 1001 -g 1001 node
RUN set -x \
# Add user
&& addgroup --gid 1000 app \
&& adduser --disabled-password \
--gecos '' \
--ingroup app \
--home /app \
--uid 1000 \
app
USER app
WORKDIR /app
FROM base AS builder
COPY --chown=app:app package*.json ./
RUN PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true npm ci --cache .npm --prefer-offline
COPY --chown=app:app . ./
RUN npm run build
# Main image
FROM base
RUN mkdir -p /app/.config/configstore
COPY --chown=app:app package*.json ./
COPY --chown=app:app --from=builder /app/.npm .npm
RUN npm ci --omit=dev --cache .npm --prefer-offline \
&& npm cache clean --force --cache .npm
COPY --chown=app:app app app
COPY --chown=app:app common common
COPY --chown=app:app public/locales public/locales
COPY --chown=app:app server server
COPY --chown=app:app --from=builder /app/dist dist
RUN ln -s dist/version.json version.json
ENV PORT=1443
CMD ["node", "server/bin/prod.js"]