Skip to content

Commit cdecf5c

Browse files
committed
Document blog production build and prune old posts
1 parent e5eb98e commit cdecf5c

File tree

16 files changed

+70
-456
lines changed

16 files changed

+70
-456
lines changed

Caddyfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
:3000 {
2+
@root path /
3+
redir @root /blog/ 308
4+
handle_path /blog* {
5+
root * /srv/blog
6+
file_server
7+
}
8+
}

Dockerfile

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# syntax=docker/dockerfile:1
2+
3+
FROM node:20-alpine AS build
4+
WORKDIR /app
5+
6+
ENV NODE_ENV=production \
7+
NEXT_TELEMETRY_DISABLED=1
8+
9+
RUN apk add --no-cache libc6-compat
10+
11+
COPY package.json package-lock.json ./
12+
RUN npm ci
13+
14+
COPY . .
15+
16+
ARG BLOG_BASEURL=/
17+
ENV BLOG_BASEURL=${BLOG_BASEURL}
18+
19+
RUN npm run build
20+
21+
FROM caddy:2.9-alpine AS runner
22+
WORKDIR /srv/blog
23+
24+
RUN addgroup -S caddy && adduser -S caddy -G caddy
25+
COPY --from=build --chown=caddy:caddy /app/build ./
26+
COPY Caddyfile /etc/caddy/Caddyfile
27+
28+
EXPOSE 3000
29+
USER caddy
30+
ENTRYPOINT ["caddy", "run", "--config", "/etc/caddy/Caddyfile"]

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,3 +58,8 @@ The Graphics Programming Blog - A collection of technical articles, project post
5858
```
5959

6060
- `http://localhost:3000` should open automatically
61+
62+
## Production image
63+
- Build: `npm run build` produces the `build/` directory.
64+
- Final container copies only `build/` plus the Caddy service binary; there is no Node/npm runtime remaining, everything is pre-rendered.
65+
- Run in production with `--read-only` and `tmpfs` (e.g. `/tmp:size=32m`, `/config:size=32m`, `/data:size=32m`) so Caddy can keep its cache/autosave files while leaving the image immutable.

blog/2025/2025-09-24-optimised-triangle/index.md

Lines changed: 0 additions & 27 deletions
This file was deleted.
-2.87 KB
Binary file not shown.
-71.4 KB
Binary file not shown.

blog/2025/2025-10-19-uis-are-hard/index.md

Lines changed: 0 additions & 429 deletions
This file was deleted.
-6.73 KB
Binary file not shown.
-8.09 KB
Binary file not shown.
-9.75 KB
Binary file not shown.

0 commit comments

Comments
 (0)