-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile.backend
More file actions
28 lines (22 loc) · 880 Bytes
/
Dockerfile.backend
File metadata and controls
28 lines (22 loc) · 880 Bytes
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
# Step 1: Build the app
FROM node:20-slim AS builder
WORKDIR /app
COPY package*.json ./
RUN npm install
# Step 2: Copy backend source files
COPY ./packages/dashboard/src/server ./packages/dashboard/src/server
COPY ./tsconfig.json ./tsconfig.json
RUN npm run build:backend
# Stage 2: Production environment
FROM node:20-slim
WORKDIR /app
# Copy only the production dependencies
COPY package*.json ./
RUN npm install --production && npm cache clean --force
# Copy the build artifacts from the builder stage
COPY --from=builder /app/dist /app/dist
# Copy .graphql files to the dist folder in a single step
COPY ./packages/dashboard/src/server/OAuth/*.graphql ./dist/packages/dashboard/src/server/OAuth/
COPY ./packages/dashboard/src/server/Metrics/*.graphql ./dist/packages/dashboard/src/server/Metrics/
EXPOSE 4000
CMD ["node", "dist/packages/dashboard/src/server/server.mjs"]