The COPY apps/web step was failing with: cannot copy to non-directory: .../app/apps/web/node_modules/@hookform/resolvers because the host node_modules symlink conflicted with BuildKits overlayfs cache mount. Adding --exclude=node_modules sidesteps the conflict (the node_modules in the image is freshly created by the earlier bun install). Parent: t_e1cbd87d
26 lines
824 B
Docker
26 lines
824 B
Docker
# Build stage
|
|
FROM oven/bun:1.3 AS builder
|
|
WORKDIR /app
|
|
|
|
# Copy workspace manifests + lockfile
|
|
COPY package.json bunfig.toml bun.lock ./
|
|
COPY apps/web/package.json apps/web/package.json
|
|
COPY apps/api/package.json apps/api/package.json
|
|
COPY apps/worker/package.json apps/worker/package.json
|
|
COPY packages/db/package.json packages/db/package.json
|
|
COPY packages/shared/package.json packages/shared/package.json
|
|
|
|
# Install dependencies (workspace-aware)
|
|
RUN bun install --frozen-lockfile 2>/dev/null || bun install
|
|
|
|
# Copy full web app source (exclude node_modules to avoid BuildKit cache mount conflict)
|
|
COPY --exclude=node_modules apps/web ./apps/web
|
|
|
|
# Build the SPA
|
|
RUN cd apps/web && bun run build
|
|
|
|
# Serve stage
|
|
FROM caddy:alpine
|
|
COPY --from=builder /app/apps/web/dist /usr/share/caddy
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|