A personal blog built with Astro, containerized with Docker, and reverse-proxied with Nginx.
Pointing the domain to your local machine in your hosts file is crucial to make it behave exactly like the production server. Without it, you won't be able to test all the Nginx overrides, like the proper language redirects.
Edit your hosts
file to point patrykb.pl
to your local machine:
127.0.0.1 patrykb.pl
docker run --rm -d `
--name local-nginx-proxy `
-p 80:80 `
-v <absolute-path-to-this-dir>\nginx-local-proxy.conf:/etc/nginx/nginx.conf:ro `
nginx:alpine
docker run --rm -d \
--name local-nginx-proxy \
--network host \
-v <absolute-path-to-this-dir>/nginx-local-proxy.conf:/etc/nginx/nginx.conf:ro \
nginx:alpine
Note: Replace
<absolute-path-to-this-dir>
with the full path to your project directory.
Open http://patrykb.pl
(or http://localhost
if you didn't decide to meddle with your hosts file) in your browser.
- On Linux/MacOS/Git Bash:
Run./build-and-push.sh
- On Windows PowerShell:
Run./build-and-push.ps1
The script will output the new image tag (e.g., 240526_2130
).
$env:IMAGE_TAG = "<paste-tag-here>"
docker stack deploy --with-registry-auth -c .\compose.prod.yml blog-astro
IMAGE_TAG=<paste-tag-here> docker stack deploy --with-registry-auth -c compose.prod.yml blog-astro
- Make sure you're logged in to GitHub Container Registry (
ghcr.io
) before pushing images. - The Nginx proxy is only for local development. In production, Nginx is configured inside the container.
- If you update the Nginx config or static files, rebuild and redeploy the Docker image.