Files
podcastic/Dockerfile
T
MichaelandClaude Haiku 4.5 1822ab1afe fix: single container without nginx — Express serves frontend
- Remove separate backend/ and frontend/ Dockerfiles
- Add root Dockerfile (3-stage: frontend build → backend build → runtime)
- Frontend static files served by Express from /public
- Simplify docker-compose to 3 services: mongodb, redis, app (port 3579)
- Fix vite proxy not to strip /api prefix from paths
- Default API URL to relative /api instead of hardcoded localhost

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
2026-04-16 10:43:06 +02:00

49 lines
882 B
Docker

# Stage 1: Build frontend
FROM node:20-alpine AS frontend-builder
WORKDIR /frontend
COPY frontend/package*.json ./
RUN npm ci
COPY frontend/ ./
# Build with /api as the API base URL (served by Express on same host)
ENV VITE_API_URL=/api
RUN npm run build
# Stage 2: Build backend
FROM node:20-alpine AS backend-builder
WORKDIR /app
COPY backend/package*.json ./
RUN npm ci
COPY backend/tsconfig.json ./
COPY backend/src ./src
RUN npm run build
# Stage 3: Production image
FROM node:20-alpine
WORKDIR /app
# Copy backend production deps
COPY backend/package*.json ./
RUN npm ci --omit=dev
# Copy compiled backend
COPY --from=backend-builder /app/dist ./dist
# Copy frontend build into public/ (backend will serve it as static files)
COPY --from=frontend-builder /frontend/dist ./public
EXPOSE 3579
ENV NODE_ENV=production
ENV PORT=3579
CMD ["node", "dist/index.js"]