# Stage 1: Build frontend FROM oven/bun:latest AS frontend-build WORKDIR /app/frontend COPY frontend/package.json frontend/bun.lock* ./ RUN bun install --frozen-lockfile COPY frontend/ ./ RUN bun run build # Stage 2: Build backend FROM golang:1.24-alpine AS backend-build WORKDIR /app/backend COPY backend/go.mod backend/go.sum ./ RUN go mod download COPY backend/ ./ # Copy frontend dist into the embed location COPY --from=frontend-build /app/frontend/dist ./cmd/server/frontend_dist/ # Copy migrations into the embed location COPY backend/migrations/*.sql ./cmd/server/migrations/ RUN CGO_ENABLED=0 go build -o /server ./cmd/server # Stage 3: Final image FROM alpine:latest RUN apk --no-cache add ca-certificates COPY --from=backend-build /server /server EXPOSE 8080 CMD ["/server"]