From f3e97772676959ad6077dde645b5f99847db4776 Mon Sep 17 00:00:00 2001 From: Ilia Mashkov Date: Mon, 9 Feb 2026 11:37:47 +0300 Subject: [PATCH] feat: switch to caddy --- Dockerfile | 29 +++++++++-------------------- 1 file changed, 9 insertions(+), 20 deletions(-) diff --git a/Dockerfile b/Dockerfile index fd082a4..30d1444 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,33 +1,22 @@ # Build stage FROM node:20-alpine AS builder - WORKDIR /app - -# Copy package files COPY package.json yarn.lock ./ - -# Install dependencies RUN yarn install --frozen-lockfile - -# Copy source code COPY . . - -# Build the app RUN yarn build -# Production stage - tiny Python server -FROM python:3.11-alpine +# Production stage - Caddy +FROM caddy:2-alpine -WORKDIR /app +WORKDIR /usr/share/caddy -# Copy built static files -COPY --from=builder /app/dist ./dist +# Copy built static files from the builder stage +COPY --from=builder /app/dist . -# Expose port +# Expose the port Caddy will listen on EXPOSE 3000 -# Set environment variable -ENV PYTHONUNBUFFERED=1 - -# Start the server -CMD ["python", "-m", "http.server", "3000", "--directory", "dist"] +# Start Caddy as a file server with SPA support +# It serves files from the current dir and redirects unknown paths to index.html +CMD ["caddy", "file-server", "--listen", ":3000", "--try-files", "index.html"]