Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
82 lines (80 loc) · 4.37 KB
/
Copy pathdocker-compose.yml
File metadata and controls
82 lines (80 loc) · 4.37 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
services:
alto:
image: ghcr.io/ufal/atrium-ocr-postprocess:${ATRIUM_VERSION:-dev}
# The host uid, group 0 (atrium-project#69, roadmap B6). ./data is in the clone
# (data/.gitkeep), owned by whoever cloned it, while the image runs as uid 10001 by
# default -- so without this every write to /data fails with EACCES. Every path the
# image writes is group-0 writable, so any uid with group 0 works. On Linux set
# ATRIUM_UID in .env (`echo "ATRIUM_UID=$(id -u)" >> .env`); Docker Desktop needs
# nothing. Unset, this is the image's own uid 10001. Inherited by `api` (extends:).
user: "${ATRIUM_UID:-10001}:0"
build:
context: .
args:
ATRIUM_RUNNER_IMAGE: ghcr.io/ufal/atrium-ocr-postprocess:${ATRIUM_VERSION:-dev}
ATRIUM_RUNNER_REPO: https://github.com/ufal/atrium-ocr-postprocess
ATRIUM_RUNNER_REF: ${ATRIUM_RUNNER_REF:-dev}
environment:
ATRIUM_RUNNER_IMAGE: ghcr.io/ufal/atrium-ocr-postprocess:${ATRIUM_VERSION:-dev}
ATRIUM_RUNNER_REPO: https://github.com/ufal/atrium-ocr-postprocess
ATRIUM_RUNNER_REF: ${ATRIUM_RUNNER_REF:-dev}
HF_HOME: /cache/huggingface
volumes:
- ./data:/data
- hf-cache:/cache/huggingface
- alto-models:/app/models # persists lid.176.bin (seeded from the image only while EMPTY)
- ./setup/config.txt:/app/setup/config.txt:ro
# API profile — only starts with: docker compose --profile api up
api:
extends: alto
profiles: ["api"]
# issue #55: builds the Dockerfile's own `api` stage instead of overriding the batch
# image's entrypoint here. The old `entrypoint:` line was the ONLY place this
# service's start command existed, so no runnable API image was ever published
# (nothing to `docker pull` for Kubernetes) and the Dockerfile's HEALTHCHECK /
# STOPSIGNAL could not apply to it.
#
# The published name (atrium-project#69, roadmap B2): `-api` is part of the image NAME,
# as docker-tool.reusable.yml publishes it, so `ATRIUM_VERSION=1.6.0-beta docker compose
# --profile api pull` fetches the released image. The old `…:<version>-api` tag was never
# published by any build.
image: ghcr.io/ufal/atrium-ocr-postprocess-api:${ATRIUM_VERSION:-dev}
build:
context: .
target: api
# Its own build arg (atrium-project#69): `extends: alto` MERGES `build:`, so without
# this line the api image baked the batch image's name into its ENV.
args:
ATRIUM_RUNNER_IMAGE: ghcr.io/ufal/atrium-ocr-postprocess-api:${ATRIUM_VERSION:-dev}
# env_file delivers every OTHER variable in .env.example into the container --
# LOG_LEVEL, GRACEFUL_SHUTDOWN_S, HOST, RELOAD, HEALTHCHECK_PATH and
# MAX_UPLOAD_MB were all documented but undeliverable under compose until
# atrium-project#60 added this. `required: false` because .env is gitignored --
# a fresh clone has none and compose must still start.
env_file:
- path: .env
required: false
environment:
# ATRIUM_RUNNER_IMAGE is overridden here on purpose: `extends: alto` (above)
# inherits the batch service's environment block, whose ATRIUM_RUNNER_IMAGE
# names the batch image -- so without this line, paradata recorded the BATCH
# image for requests served by the API image. (atrium-project#60, same class
# of defect as atrium-page-classification's.) The build arg above does the same
# for the image's baked ENV (atrium-project#69).
ATRIUM_RUNNER_IMAGE: ghcr.io/ufal/atrium-ocr-postprocess-api:${ATRIUM_VERSION:-dev}
ALLOWED_ORIGINS: ${ALLOWED_ORIGINS:-http://localhost:8080,http://localhost:5500}
PORT: ${PORT:-8000}
ports:
# PORT is passed through so `PORT=9000 docker compose --profile api up` moves the
# listener, the published port and the container's own HEALTHCHECK together — the
# service reads it in service/text_api.py's __main__ block and service/healthcheck.py
# probes it. (atrium-project#58)
- "${PORT:-8000}:${PORT:-8000}"
# HEALTHCHECK comes from the `api` stage — no override needed. stop_grace_period
# raised from Compose's 10s default: the stage allows uvicorn 20s to drain in-flight
# requests plus up to 25s in serve_lifecycle, so 10s would SIGKILL mid-drain. Matches
# atrium-project/docs/templates/k8s/atrium-service.deployment.yaml's budget.
stop_grace_period: 60s
volumes:
hf-cache:
alto-models: