diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..0926635 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,7 @@ +.git +.github +.vscode +.astro +dist +node_modules +.env* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e607d43 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +# Build with the repo root as context: docker build . +# +# The site is fully static (astro `output: 'static'`): the build renders +# everything to dist/ and nginx serves it — no runtime env needed. On hotbox, +# create a GitHub service pointing at this repo (Dockerfile at the root) and +# set the service's public port to 8080. + +FROM node:22-slim AS builder +WORKDIR /app + +# Bun is the package manager (bun.lockb); the official binary from the +# oven/bun image runs fine on the same debian base. +COPY --from=oven/bun:1 /usr/local/bin/bun /usr/local/bin/bun + +COPY package.json bun.lockb ./ +RUN bun install --frozen-lockfile + +COPY . . + +# Sentry sourcemap upload self-disables (no auth token set), same as CI. +ENV ASTRO_TELEMETRY_DISABLED=1 +RUN bun run build + +FROM nginx:alpine AS runner +COPY nginx.conf /etc/nginx/conf.d/default.conf +COPY --from=builder /app/dist /usr/share/nginx/html +EXPOSE 8080 diff --git a/astro.config.ts b/astro.config.ts index 7139d96..d7950be 100644 --- a/astro.config.ts +++ b/astro.config.ts @@ -6,7 +6,7 @@ import { defineConfig } from 'astro/config' import spotlightjs from '@spotlightjs/astro' import starlightLinksValidator from 'starlight-links-validator' -const SITE_URL = 'https://docs.efp.app/' +const SITE_URL = 'https://docs.efp.rip/' // https://astro.build/config export default defineConfig({ diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000..90507b7 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,21 @@ +server { + listen 8080; + root /usr/share/nginx/html; + index index.html; + + gzip on; + gzip_types text/css application/javascript application/json image/svg+xml text/plain; + + # Astro emits content-hashed assets under /_astro/ — safe to cache forever. + location /_astro/ { + add_header Cache-Control "public, max-age=31536000, immutable"; + } + + # Starlight generates a 404.html page. + error_page 404 /404.html; + + location / { + # Pages are built in 'directory' format: /index.html + try_files $uri $uri/index.html $uri/ =404; + } +}