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:
|
||||
web:
|
||||
build: .
|
||||
image: python:3.11-slim
|
||||
container_name: forme-web
|
||||
ports:
|
||||
- "5000:5000"
|
||||
working_dir: /app
|
||||
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:
|
||||
- SECRET_KEY=${SECRET_KEY:-prod-secret}
|
||||
- ADMIN_USERNAME=${ADMIN_USERNAME:-ruslan}
|
||||
- ADMIN_PASSWORD=${ADMIN_PASSWORD:-utOgbZ09ruslan}
|
||||
- DATABASE=/data/app.db
|
||||
- PYTHONDONTWRITEBYTECODE=1
|
||||
- PYTHONUNBUFFERED=1
|
||||
volumes:
|
||||
- .:/app
|
||||
- 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
|
||||
|
||||
volumes:
|
||||
appdb: {}
|
||||
pydeps: {}
|
||||
|
||||
Reference in New Issue
Block a user