-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
57 lines (40 loc) · 1018 Bytes
/
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
# Build stage
FROM node:16 AS builder
RUN set -x \
# Add user
&& addgroup --gid 10001 app \
&& adduser --disabled-password \
--gecos '' \
--gid 10001 \
--home /build \
--uid 10001 \
app
USER app
# Create build dir
WORKDIR /build
COPY --chown=app:app . ./
RUN npm install
RUN [ "npm", "run", "build" ]
# Run stage
FROM node:16 as runner
# Cant get data volume to work properly when using app user
# RUN set -x \
# # Add user
# && addgroup --gid 10001 app \
# && adduser --disabled-password \
# --gecos '' \
# --gid 10001 \
# --home /app \
# --uid 10001 \
# app
# USER app
# Create app dir
WORKDIR /app
# Copy files needed in this stage from builder
COPY --from=builder ["/build/package.json", "/build/package-lock.json", "./"]
RUN npm ci --only=production
# Doesn't work when included in copy above...
COPY --from=builder /build/out ./out
VOLUME /app/data
EXPOSE 3001
CMD [ "npm", "run", "start" ]