add dockerfile

This commit is contained in:
2025-09-10 15:16:39 +03:00
parent 655e20a476
commit f1332e00e1
2 changed files with 37 additions and 1 deletions

35
Dockerfile Normal file
View File

@@ -0,0 +1,35 @@
# Use a lightweight Python base
FROM python:3.12-slim
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
# Set work directory
WORKDIR /app
# Install system dependencies (if needed for pip packages)
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first (for caching)
COPY requirements.txt /app/
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Copy the rest of the app
COPY . /app/
# Expose Flask port
EXPOSE 5000
# Default env vars (can override at runtime)
ENV FLASK_APP=app:create_app
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=5000
ENV FLASK_ENV=production
# Start Flask with Gunicorn (better for prod than flask run)
CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:5000", "app:create_app()"]

View File

@@ -1,2 +1,3 @@
Flask==3.0.3
python-dotenv==1.0.1
python-dotenv==1.0.1
gunicorn==22.0.0