-
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile
29 lines (23 loc) · 982 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
FROM node:lts-alpine as builder
# Install SSL ca certificates
RUN apk update && apk add ca-certificates
# Create appuser
RUN adduser -D -g '' appuser
# get the source code
WORKDIR /javascript-representer
COPY . .
# Install without arguments runs yarn prepublish
RUN yarn install
# Only install the node_modules we need
RUN yarn install --production --modules-folder './production_node_modules'
# Build a minimal and secured container
FROM node:lts-alpine
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /javascript-representer/package.json /opt/representer/package.json
COPY --from=builder /javascript-representer/bin /opt/representer/bin
COPY --from=builder /javascript-representer/dist /opt/representer/dist
COPY --from=builder /javascript-representer/production_node_modules /opt/representer/node_modules
USER appuser
WORKDIR /opt/representer
ENTRYPOINT ["/opt/representer/bin/run.sh"]