Containerfile
| 1 | FROM oven/bun:1 AS builder |
| 2 | WORKDIR /app |
| 3 | COPY package.json bun.lock* ./ |
| 4 | COPY scripts ./scripts |
| 5 | COPY src/styles ./src/styles |
| 6 | RUN mkdir -p public/assets |
| 7 | RUN bun install --frozen-lockfile |
| 8 | |
| 9 | FROM oven/bun:1 AS base |
| 10 | WORKDIR /app |
| 11 | |
| 12 | RUN 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 |
| 17 | COPY public ./public |
| 18 | COPY --from=builder /app/public/assets/* ./public/assets |
| 19 | |
| 20 | # Install runtime dependencies (skip postinstall — builder stage handled it) |
| 21 | COPY package.json bun.lock* ./ |
| 22 | RUN bun install --frozen-lockfile --production --ignore-scripts |
| 23 | |
| 24 | # Copy source |
| 25 | COPY src ./src |
| 26 | COPY tsconfig.json ./ |
| 27 | |
| 28 | EXPOSE 3000 |
| 29 | |
| 30 | ENV DATA_DIR=/data |
| 31 | VOLUME ["/data"] |
| 32 | |
| 33 | ENTRYPOINT ["/usr/bin/tini", "--"] |
| 34 | CMD ["sh", "-c", "bun run db:init && bun run start"] |
| 35 |