bracket-backend/Dockerfile

37 lines
689 B
Text
Raw Normal View History

2025-02-07 14:36:34 +01:00
FROM docker.io/oven/bun:alpine AS base
ENV NODE_ENV=production
2025-02-07 12:47:58 +01:00
2025-02-07 14:40:57 +01:00
RUN apk add openssl
2025-02-07 12:47:58 +01:00
WORKDIR /app
2025-02-07 14:36:34 +01:00
RUN chown -R bun:bun /app
USER bun
2025-02-07 12:47:58 +01:00
2025-02-07 14:36:34 +01:00
COPY tsconfig.build.json ./
2025-02-07 12:47:58 +01:00
COPY tsconfig.json ./
2025-02-07 14:36:34 +01:00
COPY package.json ./
COPY bun.lock ./
2025-02-07 12:47:58 +01:00
2025-02-07 14:36:34 +01:00
RUN bun install --ignore-scripts --production --frozen-lockfile
FROM base AS builder
2025-02-07 12:47:58 +01:00
COPY prisma ./prisma/
2025-02-14 17:57:32 +01:00
RUN bun install --ignore-scripts --frozen-lockfile && bunx prisma generate
2025-02-07 12:47:58 +01:00
COPY . .
RUN bun run build
2025-02-07 14:36:34 +01:00
FROM base AS runner
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/prisma ./prisma
2025-02-07 14:44:02 +01:00
COPY --from=builder /app/node_modules/.prisma/client ./node_modules/.prisma/client
2025-02-07 14:36:34 +01:00
2025-02-07 12:47:58 +01:00
EXPOSE 4000
2025-02-15 12:08:24 +01:00
CMD bun prisma migrate deploy && bun run dist/src/app