File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : CI
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ - master
8+ - develop
9+ pull_request :
10+
11+ jobs :
12+ tests :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : Set up Python
19+ uses : actions/setup-python@v5
20+ with :
21+ python-version : " 3.12"
22+
23+ - name : Install dependencies
24+ run : |
25+ python -m pip install --upgrade pip
26+ pip install -r requirements.txt
27+
28+ - name : Run pytest
29+ run : pytest
Original file line number Diff line number Diff line change @@ -56,6 +56,26 @@ docker run --rm -p 8000:8000 --env-file .env -v $(pwd)/uploads:/app/uploads imag
5656
5757Customize ` DB_URL ` , ` UPLOAD_DIR ` , etc. via the ` --env-file ` or individual ` -e ` flags.
5858
59+ ### Docker Compose & Postgres
60+
61+ For a Postgres-backed setup (with uploads persisted to a Docker volume), use the provided composition:
62+
63+ ``` bash
64+ docker compose up --build
65+ ```
66+
67+ Key environment variables for production deployments:
68+
69+ | Variable | Description |
70+ | ----------| -------------|
71+ | ` DB_URL ` | Should point to your managed database, e.g. ` postgresql+psycopg2://user:pass@host:5432/dbname ` . |
72+ | ` UPLOAD_DIR ` | Mounted path where files are stored (use a persistent volume or S3-compatible backend). |
73+ | ` RATE_LIMIT_PER_MINUTE ` | Adjust per-client quotas according to expected traffic. |
74+ | ` MAX_FILE_SIZE_BYTES ` | Enforce a tighter upload cap if needed. |
75+ | ` CACHE_MAX_AGE_SECONDS ` | Tune cache headers for served files. |
76+ | ` CORS_ORIGINS ` | Lock down origins for production frontends. |
77+ | ` ENABLE_CLEANER ` | Keep true to remove stale files automatically. |
78+
5979## API Overview
6080
6181| Method | Path | Description |
Original file line number Diff line number Diff line change 1+ version : " 3.9"
2+
3+ services :
4+ app :
5+ build : .
6+ image : image-uploader-app
7+ container_name : image-uploader-app
8+ env_file : .env
9+ environment :
10+ UPLOAD_DIR : /data/uploads
11+ DB_URL : postgresql+psycopg2://cdn:cdn@db:5432/cdn
12+ depends_on :
13+ db :
14+ condition : service_healthy
15+ volumes :
16+ - uploads-data:/data/uploads
17+ ports :
18+ - " 8000:8000"
19+
20+ db :
21+ image : postgres:16
22+ restart : always
23+ environment :
24+ POSTGRES_DB : cdn
25+ POSTGRES_USER : cdn
26+ POSTGRES_PASSWORD : cdn
27+ healthcheck :
28+ test : ["CMD-SHELL", "pg_isready -U cdn -d cdn"]
29+ interval : 10s
30+ timeout : 5s
31+ retries : 5
32+
33+ volumes :
34+ uploads-data :
You can’t perform that action at this time.
0 commit comments