-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathDockerfile
More file actions
32 lines (26 loc) · 795 Bytes
/
Dockerfile
File metadata and controls
32 lines (26 loc) · 795 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
# Stage 1: Install dependencies
FROM oven/bun:1.3-alpine AS deps
WORKDIR /app
COPY package.json bun.lock ./
RUN bun install --frozen-lockfile
# Stage 2: Build the application
FROM oven/bun:1.3-alpine AS builder
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN bun run build
# Stage 3: Production image
FROM oven/bun:1.3-alpine AS runner
WORKDIR /home/bun/app
ENV NODE_ENV=production
# Copy built assets, setting ownership to the 'bun' user
COPY --from=builder --chown=bun:bun /app/public ./public
COPY --from=builder --chown=bun:bun /app/.next/standalone ./
COPY --from=builder --chown=bun:bun /app/.next/static ./.next/static
# Use the non-root 'bun' user
USER bun
EXPOSE 3000
ENV PORT=3000
ENV HOSTNAME="0.0.0.0"
# Run the app with bun
CMD ["bun", "server.js"]