-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (26 loc) · 799 Bytes
/
Dockerfile
File metadata and controls
40 lines (26 loc) · 799 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
# ---- Build Stage ----
FROM node:22-alpine AS builder
WORKDIR /app
# Enable legacy peer deps for build
ENV NPM_CONFIG_LEGACY_PEER_DEPS=true
COPY package*.json ./
# Install all dependencies (including devDeps for build)
RUN npm ci
COPY . .
# Build args for frontend
# You can override this at build time: --build-arg VITE_API_URL=http://your-backend-url
ARG VITE_API_URL
ENV VITE_API_URL=$VITE_API_URL
# Build the app
RUN npm run build
# ---- Production Stage ----
FROM node:22-alpine AS runner
WORKDIR /app
# Install a lightweight static server
RUN npm install -g serve
# Copy built app from builder stage
COPY --from=builder /app/dist ./dist
# Expose frontend port (standard for serve is 3000)
EXPOSE 3000
# Serve the built app on port 3000
CMD ["serve", "-s", "dist", "-l", "3000"]