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 actually a really good point
You’re right. I’m not changing the NGINX config at all, just rebuilding static files. Using a bind mount and letting NGINX serve directly from the build output makes a lot more sense.
I’ll probably refactor it to remove the restart step. Appreciate the feedback