Astro site with e-book reader for classic electronics notebooks. 15 Mims notebooks + 1 Ugly's Electrical Reference, served via Docker/Caddy at mims.l.supported.systems. PDFs tracked with git-lfs.
34 lines
828 B
Docker
34 lines
828 B
Docker
# Build stage
|
|
FROM ghcr.io/astral-sh/uv:python3.11-bookworm-slim AS base
|
|
WORKDIR /app
|
|
|
|
# Install Node.js
|
|
RUN apt-get update && apt-get install -y curl && \
|
|
curl -fsSL https://deb.nodesource.com/setup_20.x | bash - && \
|
|
apt-get install -y nodejs && \
|
|
apt-get clean && rm -rf /var/lib/apt/lists/*
|
|
|
|
# Development target
|
|
FROM base AS development
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm install
|
|
COPY . .
|
|
EXPOSE 4321
|
|
CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]
|
|
|
|
# Build stage for production
|
|
FROM base AS builder
|
|
WORKDIR /app
|
|
COPY package*.json ./
|
|
RUN npm ci
|
|
COPY . .
|
|
RUN npm run build
|
|
|
|
# Production target - serve static files with Caddy
|
|
FROM caddy:alpine AS production
|
|
COPY --from=builder /app/dist /srv
|
|
COPY Caddyfile /etc/caddy/Caddyfile
|
|
EXPOSE 4321
|
|
CMD ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]
|