- Migrates the site to Svelte 5 - Still generates a static site with inlined critical path CSS for the ultimate in performance - Opens up future possibilities for site growth Reviewed-on: #1 Co-authored-by: mifi <badmf@mifi.dev> Co-committed-by: mifi <badmf@mifi.dev>
44 lines
1.2 KiB
Docker
44 lines
1.2 KiB
Docker
# Static site container for mifi Ventures
|
|
# Build stage: SvelteKit build + Critters; final stage: serve dist/ via nginx
|
|
|
|
# Stage 1: Build (SvelteKit + critical CSS inlining → dist/)
|
|
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app
|
|
|
|
# Enable pnpm via Corepack
|
|
RUN corepack enable && corepack prepare pnpm@9.15.0 --activate
|
|
|
|
COPY package.json pnpm-lock.yaml* ./
|
|
RUN pnpm install --frozen-lockfile || pnpm install
|
|
|
|
COPY svelte.config.js vite.config.ts tsconfig.json postcss.config.js ./
|
|
COPY src/ ./src/
|
|
COPY static/ ./static/
|
|
COPY scripts/ ./scripts/
|
|
|
|
RUN pnpm run build
|
|
|
|
# Stage 2: Serve
|
|
FROM nginx:alpine
|
|
|
|
# Copy custom nginx configuration
|
|
COPY nginx.conf /etc/nginx/nginx.conf
|
|
|
|
# Copy built site (dist/) from builder
|
|
COPY --from=builder /app/dist/ /usr/share/nginx/html/
|
|
|
|
# Set proper permissions
|
|
RUN chown -R nginx:nginx /usr/share/nginx/html && \
|
|
chmod -R 755 /usr/share/nginx/html
|
|
|
|
# Expose port 80
|
|
EXPOSE 80
|
|
|
|
# Health check (127.0.0.1 to avoid IPv6 localhost when nginx listens on IPv4 only)
|
|
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
CMD wget --quiet --tries=1 --spider http://127.0.0.1/ || exit 1
|
|
|
|
# Run nginx in foreground
|
|
CMD ["nginx", "-g", "daemon off;"]
|