mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-08-11 23:21:42 +00:00
Docker docs
This commit is contained in:
@@ -148,3 +148,49 @@ server {
|
||||
If desired, you could even change the port on which Spothole runs from 8080 to a plain 80, in which case your
|
||||
`proxy_pass` statements could drop the `:8080` suffix. Since Spothole is in a container, it can serve HTTP on port 80
|
||||
if desired, because it doesn't conflict with the host system.
|
||||
|
||||
### Restoring the static files bypass
|
||||
|
||||
If you would still like to bypass Spothole's web server for the static files, and serve them with nginx, you can
|
||||
do. The easiest way is to run another nginx container to serve the files, so your Spothole `compose.yaml` becomes:
|
||||
|
||||
```yaml
|
||||
services:
|
||||
spothole:
|
||||
container_name: spothole
|
||||
build:
|
||||
context: https://git.ianrenton.com/ian/spothole.git#main
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- docker-network
|
||||
volumes:
|
||||
- ./config.yml:/app/config.yml
|
||||
- ./cache:/app/cache
|
||||
|
||||
spothole-static-nginx:
|
||||
container_name: spothole-static-nginx
|
||||
build:
|
||||
context: https://git.ianrenton.com/ian/spothole.git#main
|
||||
dockerfile_inline: |
|
||||
FROM nginx:latest
|
||||
COPY static /usr/share/nginx/html
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- docker-network
|
||||
|
||||
networks:
|
||||
docker-network:
|
||||
external: true
|
||||
```
|
||||
|
||||
Then you can re-add the block that handles the `/static` path in your nginx reverse proxy config, but this time
|
||||
point it at the new container rather than at a filesystem path:
|
||||
|
||||
```nginx
|
||||
# Load static assets from the spothole-static-nginx container
|
||||
location /static/ {
|
||||
proxy_pass http://spothole-static-nginx/;
|
||||
expires 1h;
|
||||
add_header Cache-Control "public, max-age=3600, must-revalidate";
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user