-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
47 lines (33 loc) · 906 Bytes
/
Dockerfile
File metadata and controls
47 lines (33 loc) · 906 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
# ---------------------
# Build stage
# ---------------------
FROM oven/bun:1.3.3-alpine AS build
WORKDIR /app
# Copy dependency manifests
COPY package.json bun.lock ./
# Install dependencies
RUN bun install
# Copy source
COPY . .
# Build Next.js app
RUN bun --bun run build
# ---------------------
# Production stage
# ---------------------
FROM oven/bun:1.3.3-alpine AS production
# Create non-root user
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
WORKDIR /app
# Copy required runtime files
COPY --from=build /app/node_modules ./node_modules
COPY --from=build /app/package.json ./
COPY --from=build /app/.next ./.next
COPY --from=build /app/public ./public
COPY --from=build /app/src/app ./src/app
COPY --from=build /app/next.config.mjs ./next.config.mjs
# Fix ownership
RUN chown -R appuser:appgroup /app
USER appuser
EXPOSE 3001
# Start Next.js
CMD ["bun", "run", "start"]