-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathdocker-compose.prod-test.yml
More file actions
85 lines (82 loc) · 3.32 KB
/
Copy pathdocker-compose.prod-test.yml
File metadata and controls
85 lines (82 loc) · 3.32 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
83
84
85
# Production Docker build & boot verification.
# Builds the real Dockerfile (explicit file list) to catch missing COPY entries.
# Keep docker-compose.ci.yml for fast local dev with volume mounts.
#
# Usage:
# docker compose -f docker-compose.prod-test.yml up -d --build
# curl http://localhost:8081/api/system-health
# docker compose -f docker-compose.prod-test.yml down
#
# Defaults to port 8081 to avoid conflicting with the dev environment (8080).
# Override with BESS_PORT=XXXX if needed.
#
# On podman, do NOT trust podman-compose's exit code: 1.6.0 exits 0 when the
# FROM image cannot be resolved, so a failed build reads as a pass (it does
# propagate RUN failures). Check the log for "Successfully tagged".
#
# `docker compose` over podman's socket reports failures correctly and is the
# implementation CI runs, so prefer it where it works:
# export DOCKER_HOST="unix://$(podman machine inspect \
# --format '{{.ConnectionInfo.PodmanSocket.Path}}')"
# On an arm64 host it cannot build this file, though: the frontend stage is
# pinned to linux/amd64 and buildkit's QEMU emulation fails on `npm run build`
# where buildah tolerates it.
services:
bess:
build:
context: .
dockerfile: Dockerfile
args:
# Must stay a base image from build.json, so this really does test what
# ships. Building on the generic python:*-alpine instead is what let
# numpy==2.5.2 (needs py>=3.12) pass CI and then fail in the supervisor,
# whose base was py3.11. The HA bases are single-arch, so on an arm64
# host (Apple Silicon) use the aarch64 one — it is equally a shipped
# base, and avoids emulating the whole build:
# BESS_BUILD_FROM=ghcr.io/home-assistant/aarch64-base-python:3.13-alpine3.22
BUILD_FROM: ${BESS_BUILD_FROM:-ghcr.io/home-assistant/amd64-base-python:3.13-alpine3.22}
# with-contenv is required, not decoration: the HA base image's entrypoint
# is s6, and s6 does not pass the container environment to its services.
# Without it every variable below is invisible to the app, HA_URL falls
# back to http://supervisor/core, and startup blocks on retries to a host
# that does not exist here.
#
# The image's own CMD (run.sh) cannot be used instead: bashio is present on
# this base, so run.sh would force HA_URL=http://supervisor/core too.
command:
["/usr/bin/with-contenv", "python", "-m", "uvicorn", "app:app",
"--host", "0.0.0.0", "--port", "8080"]
environment:
- HA_URL=http://mock-ha:8123
- HA_TOKEN=mock_token
- HA_TEST_MODE=false
- TZ=Europe/Stockholm
- PYTHONPATH=/app
ports:
- "${BESS_PORT:-8081}:8080"
volumes:
- ./e2e/ci-options.json:/data/options.json:ro
- ./e2e/ci-bess-settings.json:/data/bess_settings.json
depends_on:
mock-ha:
condition: service_healthy
networks:
- prod-test
mock-ha:
build: ./scripts/mock_ha
environment:
- SCENARIO=${SCENARIO:-ci-normal-day}
ports:
- "8123:8123"
volumes:
- ./scripts/mock_ha/scenarios:/scenarios:ro
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://localhost:8123/mock/sensors')"]
interval: 3s
timeout: 3s
retries: 10
networks:
- prod-test
networks:
prod-test:
driver: bridge