Compose-only setup: use python:3.11-slim image, install deps at start, mount code and DB volume; no Dockerfile required
This commit is contained in:
@@ -2,18 +2,28 @@ version: "3.9"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
web:
|
web:
|
||||||
build: .
|
image: python:3.11-slim
|
||||||
container_name: forme-web
|
container_name: forme-web
|
||||||
ports:
|
working_dir: /app
|
||||||
- "5000:5000"
|
command: >-
|
||||||
|
sh -c "pip install --no-cache-dir -r requirements.txt gunicorn &&
|
||||||
|
gunicorn -b 0.0.0.0:5000 app:app --workers 2 --threads 4 --timeout 60"
|
||||||
environment:
|
environment:
|
||||||
- SECRET_KEY=${SECRET_KEY:-prod-secret}
|
- SECRET_KEY=${SECRET_KEY:-prod-secret}
|
||||||
- ADMIN_USERNAME=${ADMIN_USERNAME:-ruslan}
|
- ADMIN_USERNAME=${ADMIN_USERNAME:-ruslan}
|
||||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-utOgbZ09ruslan}
|
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-utOgbZ09ruslan}
|
||||||
- DATABASE=/data/app.db
|
- DATABASE=/data/app.db
|
||||||
|
- PYTHONDONTWRITEBYTECODE=1
|
||||||
|
- PYTHONUNBUFFERED=1
|
||||||
volumes:
|
volumes:
|
||||||
|
- .:/app
|
||||||
- appdb:/data
|
- appdb:/data
|
||||||
|
# Persist python packages so we don't reinstall on every restart
|
||||||
|
- pydeps:/usr/local/lib/python3.11/site-packages
|
||||||
|
ports:
|
||||||
|
- "5000:5000"
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
appdb: {}
|
appdb: {}
|
||||||
|
pydeps: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user