-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathDockerfile
More file actions
36 lines (26 loc) · 765 Bytes
/
Dockerfile
File metadata and controls
36 lines (26 loc) · 765 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
# Stage 1: Build the application
FROM oven/bun:1 AS builder
WORKDIR /app
# Copy dependency definitions
COPY package.json bun.lock ./
# Install dependencies
RUN bun install --frozen-lockfile
# Copy source code
COPY . .
# Build the frontend (React)
# This assumes `bun run build` creates the `dist` folder
# AND we need to compile the server code.
RUN bun run build
# Compile the server into a single binary
RUN bun build --compile --minify --sourcemap src/index.ts --outfile server
# Stage 2: Production image
FROM gcr.io/distroless/base-debian12
WORKDIR /app
# Copy the compiled binary
COPY --from=builder /app/server .
# Copy the built frontend assets
COPY --from=builder /app/dist ./dist
# Expose the port
EXPOSE 3000
# Run the binary
CMD ["./server"]