-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.movex
57 lines (39 loc) · 1.48 KB
/
Dockerfile.movex
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
# PRODUCTION DOCKERFILE
# ---------------------
# This Dockerfile allows to build a Docker image of the NestJS application
# and based on a NodeJS 16 image. The multi-stage mechanism allows to build
# the application in a "builder" stage and then create a lightweight production
# image containing the required dependencies and the JS build files.
#
# Dockerfile best practices
# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/
# Dockerized NodeJS best practices
# https://github.com/nodejs/docker-node/blob/master/docs/BestPractices.md
# https://www.bretfisher.com/node-docker-good-defaults/
# http://goldbergyoni.com/checklist-best-practice-of-node-js-in-production/
FROM node:16-alpine as builder
ENV NODE_ENV build
# USER node
WORKDIR /home/node
COPY ./package*.json ./
COPY ./yarn.lock ./
COPY ./apps ./
COPY ./util-kit ./
# Install global deps
RUN apk add g++ make py3-pip git yarn
RUN rm -rf node_modules && yarn install --frozen-lockfile && yarn add movex-server movex-service chess.js deepmerge-ts zod fp-ts deep-object-diff
COPY --chown=node:node . .
CMD ["npx", "movex build --path apps/chessroulette-web/movex.config.ts"]
# RUN node build
# ---
FROM node:16-alpine
ENV NODE_ENV production
EXPOSE 3333
# USER node
WORKDIR /home/node
RUN pwd
COPY --from=builder --chown=node:node /home/node/node_modules/ ./node_modules
COPY --from=builder --chown=node:node /home/node/.movex/ ./.movex
RUN ls -l ./
RUN ls -l ./node_modules
ENTRYPOINT ["node", ".movex/runner.js"]