-
Notifications
You must be signed in to change notification settings - Fork 1
/
frontend.Dockerfile
50 lines (30 loc) · 1.06 KB
/
frontend.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
FROM node:18.16.0 as build
WORKDIR /app
RUN npm install -g @nestjs/cli
COPY package*.json ./
COPY packages/frontend/package*.json ./packages/frontend/
COPY packages/backend/package*.json ./packages/backend/
COPY packages/shared/package*.json ./packages/shared/
RUN npm install
COPY . .
RUN npm run prisma:generate
RUN npm run shared:build
RUN npm run frontend:build
FROM node:18.16.0
WORKDIR /app
# Copy build folders
COPY --from=build /app/packages/frontend/.next /app/packages/frontend/.next
# Copy package.json and package-lock.json files
COPY --from=build /app/package*.json /app/
COPY --from=build /app/packages/frontend/package*.json /app/packages/frontend/
COPY --from=build /app/packages/backend/package*.json /app/packages/backend/
COPY --from=build /app/packages/backend/prisma /app/packages/backend/prisma
# Install production dependencies for frontend
RUN npm ci --omit=dev
# Install nestjs globally
RUN npm install -g @nestjs/cli
# Generate prisma client
RUN npm run prisma:generate
# Expose port 3000
EXPOSE 3000
CMD ["npm", "run", "start:frontend:prod"]