Add the two runtime images and their compose file: `api` (Bun bundle, runs `prisma migrate deploy` before `bun run start`) and `web` (Vite build served by nginx, which proxies `/api/*` to the API and keeps the SSE streams unbuffered with a long read timeout). The database is external and both services join the `dokploy-network` for Traefik. Remove the GitHub Actions workflow: there is no hosted CI, so the verification scripts run locally.
24 lines
861 B
Docker
24 lines
861 B
Docker
# Build context is the repository root (Bun workspace monorepo).
|
|
FROM oven/bun:1.4.0 AS build
|
|
WORKDIR /app
|
|
|
|
# Manifests first so `bun install` only reruns when the lockfile changes.
|
|
COPY package.json bun.lock bunfig.toml ./
|
|
COPY apps/api/package.json apps/api/package.json
|
|
COPY apps/web/package.json apps/web/package.json
|
|
COPY packages/shared/package.json packages/shared/package.json
|
|
RUN bun install --frozen-lockfile
|
|
|
|
COPY . .
|
|
# Empty by default: in production the SPA and the API share one origin and the
|
|
# browser calls `/api/*` (nginx proxies it). Set the build arg to point the
|
|
# frontend at a different API origin.
|
|
ARG VITE_API_URL=""
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
RUN cd apps/web && bun run build
|
|
|
|
FROM nginx:alpine AS runtime
|
|
COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf
|
|
COPY --from=build /app/apps/web/dist /usr/share/nginx/html
|
|
EXPOSE 80
|