diff --git a/Project/Dockerfile b/Project/Dockerfile index 66062bf..1852f25 100644 --- a/Project/Dockerfile +++ b/Project/Dockerfile @@ -1,33 +1,25 @@ -# Use Python 3.11 slim image -FROM python:3.11-slim +# Use Python 3.10 slim image +FROM python:3.10-slim -# Set working directory WORKDIR /app -# Set environment variables ENV PYTHONUNBUFFERED=1 -ENV PYTHONDONTWRITEBYTECODE=1 -# Install system dependencies -RUN apt-get update && apt-get install -y \ - gcc \ - && rm -rf /var/lib/apt/lists/* - -# Copy requirements file +# Copy requirements first for better caching COPY requirements.txt . -# Install Python dependencies -RUN pip install --no-cache-dir -r 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 microservice.py . +COPY . . + +ENV FLASK_ENV=production +ENV FLASK_APP=microservice.py +ENV FLASK_RUN_HOST=0.0.0.0 +ENV FLASK_RUN_PORT=5001 -# Expose port 5001 EXPOSE 5001 -# Health check -HEALTHCHECK --interval=30s --timeout=10s --start-period=5s --retries=3 \ - CMD python -c "import requests; requests.get('http://localhost:5001/', timeout=5)" - -# Run the application with gunicorn -CMD ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "2", "--timeout", "120", "--access-logfile", "-", "--error-logfile", "-", "microservice:app"] \ No newline at end of file +CMD ["gunicorn", "--bind", "0.0.0.0:5001", "--workers", "2", "--timeout", "120", "microservice:app"] \ No newline at end of file