25 lines
575 B
Docker
25 lines
575 B
Docker
# Use Python 3.10 slim image
|
|
FROM python:3.10-slim
|
|
|
|
WORKDIR /app
|
|
|
|
ENV PYTHONUNBUFFERED=1
|
|
|
|
# Copy requirements first for better caching
|
|
COPY requirements.txt .
|
|
|
|
# Install Python packages with timeout
|
|
RUN pip install --no-cache-dir -r requirements.txt \
|
|
--timeout=100 || pip install --no-cache-dir -r requirements.txt
|
|
|
|
# Copy application code
|
|
COPY . .
|
|
|
|
ENV FLASK_ENV=production
|
|
ENV FLASK_APP=microservice.py
|
|
ENV FLASK_RUN_HOST=0.0.0.0
|
|
ENV FLASK_RUN_PORT=5001
|
|
|
|
EXPOSE 5001
|
|
|
|
CMD ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "2", "--timeout", "120", "microservice:app"] |