- Add docker-compose.prod.yml and Caddyfile for Caddy reverse proxy - Add production stages to frontend Dockerfile (nginx for static files) - Fix monorepo package exports for production builds (dist/src paths) - Add CORS_ORIGIN env var for cross-origin config - Add Better Auth baseURL, cookie domain, and trusted origins from env - Use VITE_API_URL for API calls in auth-client and play route - Add credentials: include for cross-origin fetch requests - Remove unused users table from schema
36 lines
889 B
Docker
36 lines
889 B
Docker
# 1. Base
|
|
FROM node:24-alpine AS base
|
|
RUN npm install -g pnpm
|
|
|
|
# 2. Deps
|
|
FROM base AS deps
|
|
WORKDIR /app
|
|
COPY pnpm-lock.yaml pnpm-workspace.yaml package.json ./
|
|
COPY apps/web/package.json ./apps/web/
|
|
COPY packages/shared/package.json ./packages/shared/
|
|
RUN pnpm install --frozen-lockfile
|
|
|
|
# 3. Dev
|
|
FROM base AS dev
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . ./
|
|
EXPOSE 5173
|
|
CMD ["pnpm", "--filter", "web", "dev", "--host"]
|
|
|
|
# 4. Build
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY --from=deps /app/node_modules ./node_modules
|
|
COPY . .
|
|
RUN pnpm install
|
|
ARG VITE_API_URL
|
|
ENV VITE_API_URL=$VITE_API_URL
|
|
RUN pnpm --filter shared build
|
|
RUN pnpm --filter web build
|
|
|
|
# 5. Production — just nginx serving static files
|
|
FROM nginx:alpine AS production
|
|
COPY --from=builder /app/apps/web/dist /usr/share/nginx/html
|
|
COPY apps/web/nginx.conf /etc/nginx/conf.d/default.conf
|
|
EXPOSE 80
|