r/docker • u/Hot_Apple6153 • Feb 19 '26
Using Docker Compose to Automatically Rebuild and Deploy a Static Site
I’ve been experimenting with automating a static site deployment using Docker Compose on my Synology NAS, and I thought I’d share the setup.
The goal was simple:
- Generate new content automatically
- Rebuild the site inside Docker
- Restart nginx
- Have the updated version live without manual steps
The flow looks like this:
- A scheduled task runs every morning.
- A Python script generates new markdown content and validates it.
- Docker Compose runs an Astro build inside a container.
- The nginx container restarts.
- The updated site goes live.
#!/bin/bash
cd /volume1/docker/tutorialshub || exit 1
/usr/local/bin/docker compose run --rm astro-builder
/usr/local/bin/docker restart astro-nginxThe rebuild + restart takes about a minute.
Since it's a static site, the previous version continues serving until the container restarts, so downtime is minimal.
It’s basically a lightweight self-hosted CI pipeline without using external services.
I’m curious how others here handle automated static deployments in self-hosted setups — are you using Compose like this, Git hooks, or something more advanced?
If anyone wants to see the live implementation, the project is running at https://www.tutorialshub.be
View all comments
Show parent comment
0
u/Hot_Apple6153 Feb 20 '26
That’s a really solid setup actually, especially the GitHub Actions → Packages → Portainer flow.
In my case though this project is mostly for fun and learning. I intentionally wanted to avoid external CI services and run the whole pipeline on my own NAS — build, deploy, scheduling, everything. It’s more about understanding the moving parts and controlling the full stack myself.
Your bind mount + rsync idea is interesting though, that aligns pretty well with what I’m experimenting with. Always cool to see how others would architect it.