Containerfile
Raw
1FROM oven/bun:1 AS builder
2WORKDIR /app
3COPY package.json bun.lock* ./
4COPY scripts ./scripts
5COPY src/styles ./src/styles
6RUN mkdir -p public/assets
7RUN bun install --frozen-lockfile
8
9FROM oven/bun:1 AS base
10WORKDIR /app
11
12RUN apt-get --update install -y --no-install-recommends \
13 tini openssh-client git-core zstd \
14 && rm -rf /var/lib/apt/lists/*
15
16# Copy public first so postinstall can write vendor files into it
17COPY public ./public
18COPY --from=builder /app/public/assets/* ./public/assets
19
20# Install runtime dependencies (skip postinstall — builder stage handled it)
21COPY package.json bun.lock* ./
22RUN bun install --frozen-lockfile --production --ignore-scripts
23
24# Copy source
25COPY src ./src
26COPY tsconfig.json ./
27
28EXPOSE 3000
29
30ENV DATA_DIR=/data
31VOLUME ["/data"]
32
33ENTRYPOINT ["/usr/bin/tini", "--"]
34CMD ["sh", "-c", "bun run db:init && bun run start"]
35