forked from tinystacks/netlify-cms-github-auth
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
26 lines (22 loc) · 831 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
# Generates a container to run the compilled node.js scripts in
# -> runs as the "node" user so any extra folders will need to be chown-ed
# -> Uses a multi-stage to compile JavaScript and produce a slim image
# [0] A common base for both stages
FROM node:14-alpine as base
RUN mkdir /app && chown -R node:node /app
COPY --chown=node ["package*.json", "tsconfig.json", "/app/"]
USER node
WORKDIR /app
# [1] A builder to install modules and run a build
FROM base as builder
ENV NODE_ENV development
RUN npm ci
COPY --chown=node ["src", "/app/src"]
RUN npm run build
# [2] From the base again, install production deps and copy compilled code
FROM base as dist
EXPOSE 3000
ENV NODE_ENV production
RUN npm ci && npm cache clean --force
COPY --from=builder --chown=node ["/app/dist", "/app/dist"]
ENTRYPOINT ["node", "dist/app.js"]