This commit is contained in:
pika 2025-03-31 17:17:48 +02:00
parent af4b75acb4
commit 3036042416
6 changed files with 30 additions and 82 deletions

View file

@ -1,25 +0,0 @@
FROM python:3.11-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
RUN pip install gunicorn psycopg2-binary redis
# Copy application code
COPY . .
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV PYTHONDONTWRITEBYTECODE=1
# Run the application
CMD ["gunicorn", "-w", "4", "-b", ":8000", "app:create_app()"]

View file

@ -1,53 +0,0 @@
version: '3'
services:
app:
build:
context: ..
dockerfile: config/Dockerfile
command: gunicorn -w 4 -b :8000 "app:create_app()" --access-logfile - --error-logfile -
volumes:
- ../app:/app/app
environment:
- FLASK_APP=app
- FLASK_ENV=production
- DATABASE_URL=postgresql://user:password@db:5432/app_db
- REDIS_URL=redis://redis:6379/0
- SECRET_KEY=${SECRET_KEY:-default_secret_key_change_in_production}
depends_on:
- db
- redis
restart: unless-stopped
nginx:
image: nginx:1.25
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/conf.d:/etc/nginx/conf.d
- ./nginx/ssl:/etc/nginx/ssl
depends_on:
- app
restart: unless-stopped
db:
image: postgres:15
environment:
POSTGRES_USER: user
POSTGRES_PASSWORD: password
POSTGRES_DB: app_db
volumes:
- pg_data:/var/lib/postgresql/data
restart: unless-stopped
redis:
image: redis:7
volumes:
- redis_data:/data
restart: unless-stopped
volumes:
pg_data:
redis_data: