-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
49 lines (33 loc) · 978 Bytes
/
Copy pathDockerfile
File metadata and controls
49 lines (33 loc) · 978 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
41
42
43
44
45
46
47
48
49
# Multi-stage build for DiasporaNest (Vite + React + Express)
# Stage 1: Build the frontend
FROM node:18-alpine AS frontend-builder
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install all dependencies (including devDependencies for build)
RUN npm ci
# Copy source code
COPY . .
# Build the Vite frontend
RUN npm run build
# Stage 2: Production runtime
FROM node:18-alpine AS production
WORKDIR /app
# Copy package files
COPY package*.json ./
# Install only production dependencies
RUN npm ci --only=production
# Copy the built frontend from builder stage
COPY --from=frontend-builder /app/dist ./dist
# Copy server files
COPY server ./server
# Copy other necessary config files
COPY vite.config.js* ./
COPY tailwind.config.js* ./
COPY postcss.config.js* ./
# Expose the port (adjust if your server uses a different port)
EXPOSE 3000
# Set environment to production
ENV NODE_ENV=production
# Start the Express server
CMD ["node", "server/index.js"]