-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathContainerfile
More file actions
33 lines (24 loc) · 1.06 KB
/
Containerfile
File metadata and controls
33 lines (24 loc) · 1.06 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
FROM oven/bun:1.3.3 as builder
WORKDIR /app
COPY package.json bun.lockb* ./
# Use --frozen-lockfile to ensure reproducible builds
RUN bun install --frozen-lockfile
# Copy the rest of the source code
COPY . .
# Run the build command defined in package.json (e.g., "vite build")
RUN bun run build
# ----------------------------------------------------------------------
# 2. Production Stage
# Use a minimal Nginx image to serve the compiled static files securely and efficiently
# ----------------------------------------------------------------------
FROM nginx:alpine
# Copy the built application files from the builder stage into the Nginx public directory
COPY --from=builder /app/dist /usr/share/nginx/html
# Nginx listens on port 80 by default
EXPOSE 80
# Configure Nginx to handle single-page application routing (optional, but recommended)
# This prevents 404 errors when users hit a route directly, ensuring all non-file
# requests fall back to index.html.
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Command to start Nginx
CMD ["nginx", "-g", "daemon off;"]