-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (22 loc) · 813 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (22 loc) · 813 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
# Stage 1: Build the Astro app with Bun
FROM oven/bun:latest AS builder
WORKDIR /app
# Copy package files (Bun uses bun.lockb for lock information)
COPY package.json bun.lockb ./
# Install dependencies using Bun
RUN bun install --frozen-lockfile
# Copy the rest of your application code
COPY . .
# Build the Astro app
RUN bun run build
# Stage 2: Run the built server bundle using Bun
FROM oven/bun:latest AS runner
WORKDIR /app
# The SSR bundle externalizes some deps (e.g. `cookie`). Install the
# lockfile-pinned production deps so Bun doesn't auto-install the latest
# version of those packages at runtime.
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile --production
COPY --from=builder /app/dist ./dist
EXPOSE 4321
CMD ["sh", "-c", "HOST=:: PORT=4321 bun ./dist/server/entry.mjs"]