Docker buid issue

This commit is contained in:
2025-10-17 11:04:16 +05:30
parent a3d3fa4435
commit 739b88e92c
3 changed files with 44 additions and 32 deletions

View File

@ -1,36 +1,24 @@
# Use official Python base image (faster & smaller than Ubuntu + manual Python)
FROM python:3.10-slim
# Set working directory
WORKDIR /app
# Prevent Python from buffering stdout/stderr
ENV PYTHONUNBUFFERED=1
# Install mysql-client for database connectivity checks
RUN apt-get update && \
apt-get install -y default-mysql-client curl && \
rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Use PyPI mirror + increased timeout to avoid network errors
# Install Python packages with timeout
RUN pip install --no-cache-dir -r requirements.txt \
-i https://pypi.org/simple \
--timeout=100
--timeout=100 || pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Environment variables
ENV FLASK_ENV=production
ENV FLASK_APP=run.py
ENV FLASK_RUN_HOST=0.0.0.0
ENV FLASK_RUN_PORT=5000
# Expose the Flask port
EXPOSE 5000
# Use Gunicorn for production
CMD ["gunicorn", "--bind", "0.0.0.0:5000", "run:app"]