2026-05-18 08:39:57 +07:00
|
|
|
# Stage 1: Builder
|
2026-05-18 08:53:44 +07:00
|
|
|
FROM oven/bun:alpine AS builder
|
2026-05-18 08:39:57 +07:00
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
|
|
# Install dependencies (including devDependencies for build and lint)
|
|
|
|
|
COPY package.json tsconfig.json biome.json ./
|
|
|
|
|
RUN bun install
|
|
|
|
|
|
|
|
|
|
# Copy src and test directories
|
|
|
|
|
COPY src ./src
|
|
|
|
|
COPY test ./test
|
|
|
|
|
|
|
|
|
|
# Run lint and build
|
|
|
|
|
RUN bun run lint
|
|
|
|
|
RUN bun run build
|
|
|
|
|
|
|
|
|
|
# Stage 2: Runner
|
2026-05-18 08:53:44 +07:00
|
|
|
FROM oven/bun:slim AS runner
|
2026-05-18 08:39:57 +07:00
|
|
|
|
|
|
|
|
WORKDIR /usr/src/app
|
|
|
|
|
|
|
|
|
|
# Copy built files, schema, and package.json
|
|
|
|
|
COPY --from=builder /usr/src/app/dist/index.js ./dist/index.js
|
2026-05-18 19:46:21 +07:00
|
|
|
COPY --from=builder /usr/src/app/dist/migrate.js ./dist/migrate.js
|
2026-05-18 08:39:57 +07:00
|
|
|
COPY schema.sql ./
|
|
|
|
|
COPY package.json ./
|
|
|
|
|
|
|
|
|
|
# Expose port
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
|
|
|
|
|
# Start server
|
|
|
|
|
CMD ["bun", "dist/index.js"]
|