-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
40 lines (32 loc) · 1.06 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
###################
# BUILD FOR LOCAL DEVELOPMENT
###################
FROM node:18-alpine AS development
USER root
WORKDIR /usr/src/app
RUN apk add --no-cache tzdata
ENV TZ=Asia/Saigon
COPY --chown=node:node package*.json pnpm-lock.yaml ./
RUN corepack enable && corepack prepare [email protected] --activate
RUN pnpm install --force
COPY --chown=node:node . .
###################
# BUILD FOR PRODUCTION
###################
FROM node:18-alpine AS build
USER node
ARG NODE_ENV=production
ENV NODE_ENV $NODE_ENV
COPY --chown=node:node package*.json ./
COPY --chown=node:node pnpm-lock.yaml ./
COPY --chown=node:node --from=development /usr/src/app/node_modules ./node_modules
COPY --chown=node:node . .
RUN pnpm run build
RUN pnpm install --frozen-lockfile --prod && npm cache clean --force
###################
# PRODUCTION
###################
from node:18-alpine as production
copy --chown=node:node --from=build /usr/src/app/node_modules ./node_modules
copy --chown=node:node --from=build /usr/src/app/dist ./dist
CMD ["node", "dist/services/school-media-backend/src/main.js"]