Use bun build in the dockerfile

This commit is contained in:
Zoe Roux 2025-01-18 16:37:57 +01:00
parent ce242bf1b4
commit 87314a0e96

View File

@ -1,15 +1,28 @@
FROM oven/bun
FROM oven/bun AS builder
WORKDIR /app
COPY package.json .
COPY bun.lock .
COPY package.json bun.lock .
RUN bun install --production
COPY src src
COPY drizzle drizzle
COPY tsconfig.json .
COPY drizzle drizzle
COPY drizzle drizzle
ENV NODE_ENV production
ENV NODE_ENV=production
RUN bun build \
--compile \
--minify-whitespace \
--minify-syntax \
--target bun \
--outfile server \
./src/index.ts
FROM gcr.io/distroless/base
WORKDIR /app
COPY --from=builder /app/server server
ENV NODE_ENV=production
EXPOSE 3000
CMD ["bun", "src/index.ts"]
CMD ["./server"]