-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (30 loc) · 971 Bytes
/
Dockerfile
File metadata and controls
40 lines (30 loc) · 971 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
29
30
31
32
33
34
35
36
37
38
39
40
FROM node:20-alpine AS builder
# Set working directory
WORKDIR /app/frontend
COPY package.json .pnp.cjs .pnp.loader.mjs ./
RUN npm install -f
COPY . .
RUN VITE_API_URL=__VITE_API_URL__ \
VITE_API_VERSION=__VITE_API_VERSION__ \
VITE_ADMIN_EMAIL=__VITE_ADMIN_EMAIL__ \
VITE_GOOGLE_PROJECT_ID=__VITE_GOOGLE_PROJECT_ID__ \
VITE_GOOGLE_CLIENT_ID=__VITE_GOOGLE_CLIENT_ID__ \
VITE_GOOGLE_CLIENT_SECRET=__VITE_GOOGLE_CLIENT_SECRET__ \
VITE_GOOGLE_REDIRECT_URI=__VITE_GOOGLE_REDIRECT_URI__ \
npm run build
# EXPOSE 80
# ---------- 2. Build backend and copy frontend build ----------
FROM node:20-alpine AS backend
WORKDIR /app
# Copy backend files
COPY backend/package*.json ./
RUN npm ci
COPY backend/ ./
# Copy the built React files from previous stage
COPY --from=builder /app/frontend/dist ./dist
# Expose the server port
EXPOSE 8080
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Start the server
CMD ["/entrypoint.sh"]