mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-15 01:41:08 +02:00
Dockerfile, docker-compose service (port 5100), Caddy and cloudflared routing for the WhoPixels game. PORT is now configurable via env var. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
17 lines
1.5 KiB
Text
17 lines
1.5 KiB
Text
# syntax=docker/dockerfile:1 # Multi-stage Dockerfile for Astro landing pages # This is a template -
|
|
copy and customize for each landing page # ============================================ # Build
|
|
Stage # ============================================ FROM node:20-alpine AS builder # Install pnpm
|
|
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate WORKDIR /app # Copy workspace files
|
|
COPY pnpm-workspace.yaml ./ COPY package.json ./ COPY pnpm-lock.yaml ./ # Copy all shared packages
|
|
COPY packages/ ./packages/ # Copy the specific landing page ARG SERVICE_PATH COPY ${SERVICE_PATH}
|
|
./${SERVICE_PATH}
|
|
# Install all dependencies RUN pnpm install --frozen-lockfile # Build shared packages first RUN pnpm
|
|
run build:packages # Build the landing page WORKDIR /app/${SERVICE_PATH}
|
|
RUN pnpm build # ============================================ # Production Stage - Nginx # ============================================
|
|
FROM nginx:alpine AS production # Copy nginx configuration COPY docker/nginx/astro.conf /etc/nginx/conf.d/default.conf
|
|
# Copy built static files ARG SERVICE_PATH COPY --from=builder /app/${SERVICE_PATH}/dist
|
|
/usr/share/nginx/html # Add healthcheck script RUN echo '#!/bin/sh' > /usr/local/bin/healthcheck.sh
|
|
&& \ echo 'curl -f http://localhost/ || exit 1' >> /usr/local/bin/healthcheck.sh && \ chmod +x
|
|
/usr/local/bin/healthcheck.sh # Expose port EXPOSE 80 # Health check HEALTHCHECK --interval=30s
|
|
--timeout=10s --start-period=10s --retries=3 \ CMD /usr/local/bin/healthcheck.sh # Start nginx CMD
|
|
["nginx", "-g", "daemon off;"]
|