services: | |
server: | |
build: | |
context: . | |
# Enable BuildKit for better caching | |
cache_from: | |
- python:3.9 | |
ports: | |
- 7860:7860 | |
develop: | |
watch: | |
# Only rebuild on requirements.txt changes, sync code changes otherwise | |
- action: rebuild | |
path: ./requirements.txt | |
- action: sync | |
path: ./src | |
target: /home/user/app/src | |
- action: sync | |
path: ./README.md | |
target: /home/user/app/README.md | |
volumes: | |
- python-cache:/home/user/.cache | |
# Cache pip packages | |
- pip-cache:/home/user/.cache/pip | |
volumes: | |
python-cache: | |
pip-cache: |