forked from synmetrix/client-v2
-
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.11 KB
/
Dockerfile
File metadata and controls
49 lines (35 loc) · 1.11 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
# Build stage
FROM oven/bun:1.3.5-alpine AS builder
# Create non-root user
RUN addgroup -g 1001 -S appgroup && \
adduser -S appuser -u 1001 -G appgroup
WORKDIR /app
# Copy package files
COPY package.json bun.lock ./
RUN chown -R appuser:appgroup /app
# Switch to non-root user
USER appuser
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source code (as root to ensure proper permissions)
USER root
COPY . .
RUN chown -R appuser:appgroup /app
USER appuser
# Build the application (skip postbuild which creates archives we don't need)
RUN ./node_modules/.bin/vite build
# Production stage - use nginx for better performance
FROM nginx:alpine
# Install security updates
RUN apk upgrade --no-cache
# Copy built assets from builder stage
COPY --from=builder /app/dist /usr/share/nginx/html
# Copy nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Expose port 80
EXPOSE 80
# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/health || exit 1
# Start nginx
CMD ["nginx", "-g", "daemon off;"]