- Multi-stage Dockerfile for Go backend (golang:1.25-alpine -> alpine:3) - Multi-stage Dockerfile for Next.js frontend (bun:1 -> node:22-alpine) - docker-compose.yml with backend + frontend services, health checks - Next.js standalone output + API rewrites to proxy /api/* to backend - .dockerignore files for both services - .env.example documenting required environment variables
29 lines
582 B
Docker
29 lines
582 B
Docker
# Dependencies
|
|
FROM oven/bun:1 AS deps
|
|
WORKDIR /app
|
|
COPY package.json bun.lock ./
|
|
RUN bun install --frozen-lockfile
|
|
|
|
# Build
|
|
FROM oven/bun:1 AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
ENV API_URL=http://backend:8080
|
|
RUN mkdir -p public
|
|
RUN bun run build
|
|
|
|
# Run
|
|
FROM node:22-alpine AS runner
|
|
WORKDIR /app
|
|
ENV NODE_ENV=production
|
|
ENV HOSTNAME=0.0.0.0
|
|
ENV PORT=3000
|
|
|
|
COPY --from=builder /app/.next/standalone ./
|
|
COPY --from=builder /app/.next/static ./.next/static
|
|
COPY --from=builder /app/public ./public
|
|
|
|
EXPOSE 3000
|
|
CMD ["node", "server.js"]
|