feat: switch to caddy
All checks were successful
Workflow / build (push) Successful in 58s

This commit is contained in:
Ilia Mashkov
2026-02-09 11:37:47 +03:00
parent c4abe84b0a
commit f3e9777267

View File

@@ -1,33 +1,22 @@
# Build stage # Build stage
FROM node:20-alpine AS builder FROM node:20-alpine AS builder
WORKDIR /app WORKDIR /app
# Copy package files
COPY package.json yarn.lock ./ COPY package.json yarn.lock ./
# Install dependencies
RUN yarn install --frozen-lockfile RUN yarn install --frozen-lockfile
# Copy source code
COPY . . COPY . .
# Build the app
RUN yarn build RUN yarn build
# Production stage - tiny Python server # Production stage - Caddy
FROM python:3.11-alpine FROM caddy:2-alpine
WORKDIR /app WORKDIR /usr/share/caddy
# Copy built static files # Copy built static files from the builder stage
COPY --from=builder /app/dist ./dist COPY --from=builder /app/dist .
# Expose port # Expose the port Caddy will listen on
EXPOSE 3000 EXPOSE 3000
# Set environment variable # Start Caddy as a file server with SPA support
ENV PYTHONUNBUFFERED=1 # It serves files from the current dir and redirects unknown paths to index.html
CMD ["caddy", "file-server", "--listen", ":3000", "--try-files", "index.html"]
# Start the server
CMD ["python", "-m", "http.server", "3000", "--directory", "dist"]