Docker buid issue
This commit is contained in:
@ -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"]
|
||||
Reference in New Issue
Block a user