48 lines
973 B
Docker
48 lines
973 B
Docker
# syntax = docker/dockerfile:1
|
|
|
|
ARG BUN_VERSION=1.2.19
|
|
|
|
# Build prisma
|
|
FROM oven/bun:${BUN_VERSION} AS prisma
|
|
WORKDIR /src
|
|
|
|
COPY --link package.json ./package.json
|
|
COPY --link bun.lock ./bun.lock
|
|
|
|
COPY --link prisma ./prisma
|
|
|
|
RUN apt-get update -y && apt-get install -y openssl
|
|
RUN bun add prisma
|
|
RUN bunx --bun prisma generate
|
|
|
|
FROM oven/bun:${BUN_VERSION} AS base
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
WORKDIR /src
|
|
|
|
# Build
|
|
FROM base AS build
|
|
|
|
COPY --link package.json bun.lock ./
|
|
|
|
RUN bun install --include=dev
|
|
COPY --from=prisma /src/node_modules/.prisma node_modules/.prisma
|
|
COPY --from=prisma /src/node_modules/@prisma node_modules/@prisma
|
|
|
|
COPY --link . .
|
|
|
|
RUN bun run build -- --preset bun
|
|
|
|
# Run
|
|
FROM base
|
|
|
|
RUN apt-get update && apt-get -y install curl
|
|
|
|
HEALTHCHECK CMD curl --fail http://localhost:3000/api/health || exit 1
|
|
|
|
COPY --from=build /src/.output .
|
|
|
|
CMD ["bun", "run", "./server/index.mjs" ]
|
|
|
|
LABEL org.opencontainers.image.source=https://github.com/PassiDel/pichunt |