-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
38 lines (32 loc) · 1.16 KB
/
Dockerfile
File metadata and controls
38 lines (32 loc) · 1.16 KB
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
# -- Build Stage --
FROM node:22-alpine AS build
WORKDIR /app
# Enable corepack and install pnpm manually
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . .
# Generate Prisma Client before building the backend
RUN pnpm prisma generate
# Build the backend and frontend
RUN pnpm dlx nx build backend --configuration=production
RUN pnpm dlx nx build frontend --configuration=production
# -- Backend Stage --
FROM node:22-alpine AS backend
WORKDIR /app
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --prod --frozen-lockfile
COPY --from=build /app/apps/backend/prisma ./prisma
COPY --from=build /app/dist ./dist
# Generate Prisma Client before building the backend
RUN pnpm prisma generate --schema=./prisma/schema.prisma
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]
# -- Frontend Stage --
FROM nginx:alpine-slim AS frontend
WORKDIR /usr/share/nginx/html
# Copy built frontend files
COPY --from=build /app/dist/apps/frontend ./
COPY nginx.conf /etc/nginx/conf.d/default.conf