-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
63 lines (57 loc) · 2.63 KB
/
docker-compose.yml
File metadata and controls
63 lines (57 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Workforce Intelligence — Docker Compose configuration.
#
# Usage:
# docker compose up # build (if needed) and start in foreground
# docker compose up -d # start detached
# docker compose up --build # force a rebuild before starting
# docker compose logs -f # tail logs
# docker compose down # stop and remove the container
#
# Then open http://localhost:8501 in a browser.
#
# Note on the artifacts mount: by default we bind-mount ./artifacts into the
# container so re-running the notebook's export cell on the host updates the
# dashboard without rebuilding the image. For a self-contained production
# deployment, comment the volume out and rely on the COPY in the Dockerfile.
services:
dashboard:
# Build the image from the Dockerfile in this directory. Equivalent to
# `docker build -t workforce-intelligence .` but tied to compose lifecycle.
build:
context: .
dockerfile: Dockerfile
image: workforce-intelligence:latest
container_name: workforce-intelligence
# Map host port 8501 → container port 8501. Change the left-hand side
# if 8501 is already taken on the host (e.g. "8502:8501").
ports:
- "8501:8501"
# Live-mount the artifacts directory so re-running the notebook's export
# cell on the host immediately reflects in the dashboard (after a Streamlit
# rerun via "R"). The :ro flag makes the mount read-only inside the
# container — the dashboard never writes to artifacts/.
volumes:
- ./artifacts:/app/artifacts:ro
# Restart automatically unless the user explicitly stops the container.
# Useful if Streamlit crashes from an unhandled exception in dev or if
# the host reboots in production.
restart: unless-stopped
# Streamlit-specific environment hygiene. These mirror what we set on
# the CLI in the Dockerfile but make the configuration overridable from
# a .env file or the shell without rebuilding.
environment:
STREAMLIT_SERVER_PORT: "8501"
STREAMLIT_SERVER_ADDRESS: "0.0.0.0"
STREAMLIT_SERVER_HEADLESS: "true"
# Suppresses the first-run usage-stats opt-in prompt entirely so the
# container boots cleanly in non-interactive environments (CI, Cloud Run).
STREAMLIT_BROWSER_GATHER_USAGE_STATS: "false"
# Repeat the Dockerfile's healthcheck here so `docker compose ps` shows
# health status without having to build the image first. Compose merges
# this with the image-level healthcheck.
healthcheck:
test: ["CMD", "curl", "--fail", "http://localhost:8501/_stcore/health"]
interval: 30s
timeout: 5s
start_period: 20s
retries: 3