nanovna-f-v3-docs/Dockerfile

48 lines
1.1 KiB
Text
Raw Normal View History

# syntax=docker/dockerfile:1
# Build stage - using Node.js with pnpm
FROM node:22-alpine AS builder
# Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
WORKDIR /app
# Copy package files
COPY package.json pnpm-lock.yaml ./
# Install dependencies with cache mount
RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
# Copy source files
COPY . .
# Disable telemetry and build
ENV ASTRO_TELEMETRY_DISABLED=1
RUN pnpm build
# Production stage - lightweight static server
FROM caddy:2-alpine AS production
# Copy built static files
COPY --from=builder /app/dist /srv
# Simple Caddyfile for static file serving
# Note: caddy-docker-proxy handles the external routing
COPY <<EOF /etc/caddy/Caddyfile
:80 {
root * /srv
file_server
encode gzip
try_files {path} {path}/ /index.html
header Cache-Control "public, max-age=3600"
@immutable path /_astro/*
header @immutable Cache-Control "public, max-age=31536000, immutable"
}
EOF
EXPOSE 80
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]