| |
| FROM python:3.10-slim |
|
|
| |
| WORKDIR /app |
|
|
| |
| RUN apt-get update && apt-get install -y \ |
| build-essential \ |
| libgl1-mesa-glx \ |
| libglib2.0-0 \ |
| curl \ |
| && rm -rf /var/lib/apt/lists/* |
|
|
| |
| COPY requirements.txt . |
| RUN pip install --upgrade pip |
| RUN pip install --no-cache-dir -r requirements.txt |
|
|
| |
| COPY . . |
|
|
| |
| RUN rm -f Best_RandomForest.pkl |
|
|
| |
| RUN echo '#!/bin/bash\n\ |
| if [ ! -f Best_RandomForest.pkl ]; then\n\ |
| echo "Downloading model file..."\n\ |
| curl -o Best_RandomForest.pkl "$MODEL_URL"\n\ |
| fi\n\ |
| exec gunicorn --bind 0.0.0.0:5000 app:app' > /app/start.sh && chmod +x /app/start.sh |
|
|
| |
| EXPOSE 5000 |
|
|
| |
| ENV FLASK_APP=app.py |
| ENV FLASK_ENV=production |
|
|
| |
| CMD ["/app/start.sh"] |