diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..ec4e39e --- /dev/null +++ b/.dockerignore @@ -0,0 +1,11 @@ +.git +.gitignore +.idea +__pycache__ +*.pyc +*.pyo +.env +.venv +venv +*.log +logs diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..35c1e54 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,21 @@ +# Python 3.12 slim +FROM python:3.12-slim + +ENV PYTHONDONTWRITEBYTECODE=1 \ + PYTHONUNBUFFERED=1 + +WORKDIR /app + +# Сначала зависимости — чтобы кэшировать слой +COPY requirements.txt . +RUN pip install --no-cache-dir -r requirements.txt + +# Код приложения +COPY . . + +# Не dev-режим по умолчанию +ENV FLASK_DEBUG=0 + +EXPOSE 5000 + +CMD ["python", "app.py"] diff --git a/app.py b/app.py index 9a0a7ae..f4f6f47 100644 --- a/app.py +++ b/app.py @@ -379,4 +379,8 @@ init_database() if __name__ == "__main__": - app.run(debug=os.environ.get("FLASK_DEBUG") == "1") + app.run( + host="0.0.0.0", + port=5000, + debug=os.environ.get("FLASK_DEBUG") == "1", + ) diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..3bfa8cd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,9 @@ +# Секреты — только из .env (см. .env.example) +services: + web: + build: . + ports: + - "5000:5000" + env_file: + - .env + restart: unless-stopped