FROM oven/bun:1 AS builder WORKDIR /app COPY package.json bun.lock* ./ COPY scripts ./scripts COPY src/styles ./src/styles RUN mkdir -p public/assets RUN bun install --frozen-lockfile FROM oven/bun:1 AS base WORKDIR /app RUN apt-get --update install -y --no-install-recommends \ tini openssh-client git-core zstd \ && rm -rf /var/lib/apt/lists/* # Copy public first so postinstall can write vendor files into it COPY public ./public COPY --from=builder /app/public/assets/* ./public/assets # Install runtime dependencies (skip postinstall — builder stage handled it) COPY package.json bun.lock* ./ RUN bun install --frozen-lockfile --production --ignore-scripts # Copy source COPY src ./src COPY tsconfig.json ./ EXPOSE 3000 ENV DATA_DIR=/data VOLUME ["/data"] ENTRYPOINT ["/usr/bin/tini", "--"] CMD ["sh", "-c", "bun run db:init && bun run start"]