- IDLE_TIMEOUT_MINUTES env var (default 30 min) - restart: no policy so container stays stopped - Optional wakeup service for auto-restart - Document three restart options in readme
65 lines
1.5 KiB
YAML
65 lines
1.5 KiB
YAML
services:
|
|
streamlit:
|
|
build:
|
|
context: ..
|
|
dockerfile: Dockerfile
|
|
container_name: py-dvt-ate-streamlit
|
|
restart: "no" # Don't auto-restart - we want it to stay stopped when idle
|
|
environment:
|
|
- IDLE_TIMEOUT_MINUTES=${IDLE_TIMEOUT_MINUTES:-30}
|
|
expose:
|
|
- "8080"
|
|
volumes:
|
|
- ./data:/app/data
|
|
networks:
|
|
- dvt-ate
|
|
|
|
nginx:
|
|
image: nginx:alpine
|
|
container_name: py-dvt-ate-nginx
|
|
restart: unless-stopped
|
|
volumes:
|
|
- ./nginx.conf:/etc/nginx/nginx.conf:ro
|
|
expose:
|
|
- "80"
|
|
depends_on:
|
|
- streamlit
|
|
networks:
|
|
- dvt-ate
|
|
|
|
cloudflared:
|
|
image: cloudflare/cloudflared:latest
|
|
container_name: py-dvt-ate-tunnel
|
|
restart: unless-stopped
|
|
command: tunnel run
|
|
environment:
|
|
- TUNNEL_TOKEN=${CLOUDFLARE_TUNNEL_TOKEN}
|
|
depends_on:
|
|
- nginx
|
|
networks:
|
|
- dvt-ate
|
|
|
|
# Optional: Auto-start streamlit when stopped (checks every 30s)
|
|
# Uncomment if you want fully automatic restart on visit
|
|
# wakeup:
|
|
# image: docker:cli
|
|
# container_name: py-dvt-ate-wakeup
|
|
# restart: unless-stopped
|
|
# entrypoint: /bin/sh
|
|
# command:
|
|
# - -c
|
|
# - |
|
|
# while true; do
|
|
# sleep 30
|
|
# if ! docker inspect -f '{{.State.Running}}' py-dvt-ate-streamlit 2>/dev/null | grep -q true; then
|
|
# echo "[$(date)] Starting streamlit..."
|
|
# docker start py-dvt-ate-streamlit
|
|
# fi
|
|
# done
|
|
# volumes:
|
|
# - /var/run/docker.sock:/var/run/docker.sock:ro
|
|
|
|
networks:
|
|
dvt-ate:
|
|
driver: bridge
|