-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
36 lines (30 loc) · 895 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
#################
# Builder image #
#################
FROM node:18-alpine AS build
WORKDIR /code
ARG NPM_TOKEN
ENV NPM_TOKEN=$NPM_TOKEN
COPY . .
RUN apk update && apk upgrade && \
apk add --no-cache python3 make g++ libexecinfo-dev \
# bump npm version
RUN npm i -g [email protected]
RUN npm ci
ENV NODE_ENV=production
RUN npm run build
RUN npm ci --only=production
####################
# Production image #
####################
FROM node:18-alpine AS production
RUN apk add dumb-init python
EXPOSE 3000
WORKDIR /server
ENV NODE_ENV=production
ADD --chown=node:node https://s3.amazonaws.com/rds-downloads/rds-combined-ca-bundle.pem .
COPY --chown=node:node --from=build /code/dist ./dist/
COPY --chown=node:node --from=build /code/package.json /code/package-lock.json ./
COPY --chown=node:node --from=build /code/node_modules ./node_modules/
USER node
CMD ["dumb-init", "node", "dist/index.js"]