-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
51 lines (31 loc) · 789 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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
FROM node:18-slim AS base
WORKDIR /app
# By copying only the package.json and pnpm-lock.yaml files
COPY package.json pnpm-lock.yaml ./
# Copying the `.npmrc` file
COPY .npmrc ./
# Copying the other config files
COPY ./tsconfig.json ./
COPY ./prettier.config.cjs ./
# Installing pnpm
RUN npm install -g pnpm
FROM base AS prod-deps
RUN pnpm install --production
FROM base AS build-deps
RUN pnpm install --production=false
FROM build-deps AS build
ARG PORT=3000
ENV PORT=$PORT
ENV HOST=0.0.0.0
ENV CONTAINER=true
COPY . .
RUN pnpm run build
RUN pnpm prune --prod
FROM base AS runtime
ARG PORT=3000
ENV PORT=$PORT
ENV HOST=0.0.0.0
COPY --from=prod-deps /app/node_modules ./node_modules
COPY --from=build /app/dist ./dist
EXPOSE $PORT:$PORT
CMD node ./dist/server/entry.mjs