forked from xun082/online-edit-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
37 lines (25 loc) · 845 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
FROM node:18-alpine as base
RUN npm config set registry https://registry.npmmirror.com/
ENV PNPM_REGISTRY=https://registry.npmmirror.com/
RUN npm i -g pnpm
FROM base As dependencies
WORKDIR /home/infinity/infinity-server
COPY package.json pnpm-lock.yaml ./
RUN pnpm install
FROM base AS build
WORKDIR /home/infinity/infinity-server
COPY . .
COPY --from=dependencies /home/infinity/infinity-server/node_modules ./node_modules
RUN pnpm build
RUN pnpm prune --prod
FROM base AS deploy
WORKDIR /home/infinity/infinity-server
COPY --from=build /home/infinity/infinity-server/dist/ ./dist/
COPY --from=build /home/infinity/infinity-server/node_modules ./node_modules
ENV DATABASE_HOST=mongo
ENV DATABASE_PORT=27017
ENV DATABASE_NAME=interview
ENV DATABASE_USER=admin
ENV DATABASE_PASS=interview666
EXPOSE 8000
CMD ["node", "dist/main.js"]