-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathDockerfile
54 lines (41 loc) · 1.11 KB
/
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
54
# =============================================
#
# Build frontend & backend
#
# =============================================
FROM node:20-alpine AS build
COPY client/ tms/client/
COPY server/ tms/server/
COPY scripts/ tms/scripts/
COPY .npmrc tms/
COPY package.json tms/
COPY pnpm-lock.yaml tms/
COPY pnpm-workspace.yaml tms/
WORKDIR /tms/
# Do not download mongo-memory-server binaries.
# They are not needed for building.
ENV MONGOMS_DISABLE_POSTINSTALL=1
RUN corepack enable
RUN corepack prepare pnpm
RUN pnpm install && pnpm build
# =============================================
#
# Create the image which runs the server
#
# =============================================
FROM node:20-alpine AS production
RUN corepack enable
RUN corepack prepare pnpm
COPY --from=build tms/server/dist tms/server
COPY .npmrc tms/
COPY package.json /tms
COPY pnpm-lock.yaml tms/
COPY pnpm-workspace.yaml tms/
COPY server/package.json /tms/server
WORKDIR /tms
ENV NODE_ENV='production'
RUN pnpm install --frozen-lockfile
# Set up container entrypoint to be the server file.
EXPOSE 8080
WORKDIR /tms/server
ENTRYPOINT [ "node", "main.js" ]