Files
ForbiddenStarsApp/docker-compose.test.yml
T

42 lines
1.7 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Локальный «клон прода» в контейнере — для проверки прод-сборки на своей машине
# (а не на Raspberry Pi). Тот же образ, что и прод, но изолированные тома, единый .env
# и порт 8080 (чтобы не конфликтовать с dev-uvicorn на :8000).
#
# Обычно запускается лаунчером при APP_ENV=test (run.ps1 / run.sh). Вручную:
# docker compose -f docker-compose.test.yml up --build -d
# Открыть: http://localhost:8080 (Swagger: /api/docs)
# Остановить и стереть данные: docker compose -f docker-compose.test.yml down -v
services:
app:
build: .
image: forbidden-stars:test
container_name: forbidden-stars-test
restart: "no"
init: true
env_file:
- .env # единый .env (тот же, что у dev/prod); секреты не в git
environment:
# Окружение test: прод-клон, но отличимый от прода (см. config.is_test).
# Форсим здесь, чтобы значение не зависело от APP_ENV внутри .env.
APP_ENV: test
ports:
- "8080:8000"
volumes:
- db-data-test:/data # изолированные тестовые данные
- uploads-data-test:/data/uploads
healthcheck:
test:
- CMD
- python
- -c
- "import urllib.request; urllib.request.urlopen('http://localhost:8000/api/health')"
interval: 30s
timeout: 5s
retries: 3
start_period: 40s
mem_limit: 512m
volumes:
db-data-test:
uploads-data-test: