This repository has been archived on 2026-05-06. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
tippspiel/Dockerfile
T
Ronny f500f5f900
Build & Deploy Tippspiel / build (push) Has been cancelled
fix: skip tsc in frontend Docker build, use vite build directly
CSS modules and Vite types not available during tsc check.
Vite build works without prior tsc step.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 10:28:00 +02:00

53 lines
1.4 KiB
Docker

# ============================================================
# Stage 1: Build Frontend (React + Vite)
# ============================================================
FROM node:20-alpine AS build-frontend
WORKDIR /app/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci
COPY frontend/ ./
RUN npx vite build
# ============================================================
# Stage 2: Build Backend (TypeScript → JavaScript)
# ============================================================
FROM node:20-alpine AS build-backend
WORKDIR /app/backend
COPY backend/package.json backend/package-lock.json ./
RUN npm ci
COPY backend/ ./
RUN npx tsc
# ============================================================
# Stage 3: Production Image
# ============================================================
FROM node:20-alpine AS production
WORKDIR /app
# Nur Production-Dependencies installieren
COPY backend/package.json backend/package-lock.json ./
RUN npm ci --omit=dev && npm cache clean --force
# Compiled Backend
COPY --from=build-backend /app/backend/dist ./dist
# Frontend Build (statische Dateien)
COPY --from=build-frontend /app/backend/public ./public
# Non-root User
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
USER appuser
ENV NODE_ENV=production
ENV PORT=3001
EXPOSE 3001
HEALTHCHECK --interval=30s --timeout=5s --start-period=10s --retries=3 \
CMD wget -qO- http://localhost:3001/health || exit 1
CMD ["node", "dist/index.js"]