-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (35 loc) · 1.13 KB
/
Copy pathDockerfile
File metadata and controls
49 lines (35 loc) · 1.13 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
39
40
41
42
43
44
45
46
47
48
49
# Stage 1: Build the frontend and prepare dependencies
FROM node:20-alpine AS builder
WORKDIR /app
# Copy package files first to cache dependency installations
COPY package*.json ./
# Install all dependencies (required to build the frontend)
RUN npm ci
# Copy remaining source code
COPY . .
# Build the Vite React frontend
RUN npm run build
# Prune development dependencies to keep production image minimal
RUN npm prune --production
# Stage 2: Create the production runtime container
FROM node:20-alpine AS runner
WORKDIR /app
# Set environment to production
ENV NODE_ENV=production
ENV PORT=8030
ENV GITHUB_TOKEN=""
ENV GITHUB_CLIENT_ID=""
ENV GITHUB_CLIENT_SECRET=""
ENV GITHUB_REDIRECT_URI=""
ENV ENCRYPTION_KEY=""
# Copy package configurations and production node_modules from builder stage
COPY --from=builder /app/package.json ./
COPY --from=builder /app/node_modules ./node_modules
# Copy compiled static files
COPY --from=builder /app/dist ./dist
# Copy backend Express server
COPY --from=builder /app/server.js ./server.js
# Expose the API and web serving port
EXPOSE 8030
# Run the backend Express server
CMD ["npm", "run", "start"]