Dockerize client, server, and postgres database for production with container healthchecks

This commit is contained in:
2026-05-28 12:23:50 +02:00
parent 9a2052f623
commit 572d38e490
10 changed files with 176 additions and 11 deletions
+28
View File
@@ -0,0 +1,28 @@
# --- Build Stage ---
FROM node:20-alpine AS builder
WORKDIR /app
# Install dependencies
COPY package*.json ./
RUN npm ci
# Copy code and build production bundle
COPY . .
RUN npm run build
# --- Production Stage ---
FROM nginx:1.25-alpine
WORKDIR /usr/share/nginx/html
# Copy custom Nginx configuration
COPY nginx.conf /etc/nginx/conf.d/default.conf
# Copy built assets from builder
COPY --from=builder /app/dist .
# Expose HTTP port
EXPOSE 80
# Health check to verify Nginx is actively running
HEALTHCHECK --interval=30s --timeout=5s --start-period=3s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1