Blog launch
I'm really happy to launch my new blog system. With this I'll be able to inform people about new stuff I currently do. The launch is really easy.
While other CMS took me several couple of days without any needable progress, pelican allowed me to have a blog system within one evening right after bringing my kids to bed and my kids to bed and preparing the bread for the next day's baking.
Pelican does not provide much but enough to keep it really simple. It is not a CMS but more a static site generator that creates simple HTML and CSS files that look modern and good out from some markdown content.
The software itself is written in Python. Such an environment is needed for generating the static files. For deployment a very simple Webserver for static files is sufficient.
Docker
Because I serve everything with Docker, I also do it for that. In this case it's quite obvious, that multiple stages are a good idea. Python is only used to generate something but not used finally. So this could be done in the first stage.
FROM python:3.11-slim-bookworm AS buildpage
RUN pip install uv
WORKDIR /app
COPY pyproject.toml .
COPY uv.lock .
RUN uv sync
COPY content content/
RUN uv run pelican content
Fortunately the output is stored in the output/ directory. This could be copied to the second stage, that only uses a static file server. The --from=buildpage refers to the other stage which is named buildpage as you can see above. Python is not used anymore here, so no need to have it in the resulting Docker Image.
FROM joseluisq/static-web-server:2-debian
WORKDIR /app
COPY --from=buildpage /app/output/ ./
EXPOSE 8000
CMD ["static-web-server", "-a", "0.0.0.0", "-p", "8000", "-d", "/app", "-g", "trace"]
All together we have this Dockerfile:
FROM python:3.11-slim-bookworm AS buildpage
RUN pip install uv
WORKDIR /app
COPY pyproject.toml .
COPY uv.lock .
RUN uv sync
COPY content content/
RUN uv run pelican content
FROM joseluisq/static-web-server:2-debian
WORKDIR /app
COPY --from=buildpage /app/output/ ./
EXPOSE 8000
CMD ["static-web-server", "-a", "0.0.0.0", "-p", "8000", "-d", "/app", "-g", "trace"]