-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
45 lines (33 loc) · 1.15 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
# syntax=docker/dockerfile:experimental
# ❗❗❗ This file is autogenerated! ❗❗❗
# Managed by github.com/MyOnlineStore/repo-templating
# Changing this file will end badly, be wary.
FROM node:15-alpine
WORKDIR /srv/app
# You have to specify "--unsafe-perm" with npm ci
# when running as root. Failing to do this can cause
# install to appear to succeed even if a preinstall
# script fails, and may have other adverse consequences
# as well.
# This command will also cat the npm-debug.log file after the
# build, if it exists.
COPY package.json package-lock.json tsconfig.json ./
RUN npm ci --unsafe-perm || \
((if [ -f npm-debug.log ]; then \
cat npm-debug.log; \
fi) && false)
COPY . ./
RUN npm run build
FROM node:15-alpine
ENV NODE_ENV=production
WORKDIR /srv/app
EXPOSE 4000
COPY --chown=1001 --from=0 /srv/app/dist /srv/app/dist
COPY --chown=1001 --from=0 /srv/app/config /srv/app/config
COPY --chown=1001 --from=0 /srv/app/package.json /srv/app/package-lock.json /srv/app/
RUN --mount=type=secret,id=npm_rc,dst=/srv/app/ \
npm install --prod --save-exact
USER 1001
CMD ["node", "./dist/index.js"]
ARG COMMIT_HASH
ENV COMMIT_HASH=${COMMIT_HASH}