-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
53 lines (38 loc) · 1003 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
# 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
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 --chown=app:app --from=builder ["/build/config.yml", "/build/configWatcher.js", "/build/package.json", "/build/package-lock.json", "./"]
RUN npm ci --only=production
# Doesn't work when included in copy above...
COPY --chown=app:app --from=builder /build/.next ./.next
EXPOSE 3000
CMD [ "npm", "run", "start" ]