Download Dockerfile from Drrevcade/smartC: direct link, hf CLI and curl.
- Browser
- Download file 2.18 kB
-
https://huggingface.co/spaces/Drrevcade/smartC/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Drrevcade/smartC/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Drrevcade/smartC/resolve/main/Dockerfile
2.18 kB
| # Use a lightweight Python image | |
| FROM python:3.9-slim | |
| # Set the working directory | |
| WORKDIR /app | |
| # Copy the requirements file | |
| COPY superkart_sales_app/requirements.txt . | |
| # Install dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt && \ | |
| pip install supervisord | |
| # Copy the application files and the model file | |
| COPY superkart_sales_app/app.py . | |
| COPY superkart_sales_app/streamlit_app.py . | |
| COPY best_model.joblib . # Copy the model file | |
| # Create the supervisord configuration file | |
| RUN mkdir -p /etc/supervisord.d | |
| RUN echo "[supervisord]\n" > /etc/supervisord.conf | |
| RUN echo "nodaemon=true\n" >> /etc/supervisord.conf | |
| RUN echo "[program:flask_app]\n" >> /etc/supervisord.conf | |
| RUN echo "command=gunicorn --bind 0.0.0.0:5000 app:app\n" >> /etc/supervisord.conf # Use gunicorn to serve Flask | |
| RUN echo "directory=/app\n" >> /etc/supervisord.conf | |
| RUN echo "autostart=true\n" >> /etc.supervisord.conf | |
| RUN echo "autorestart=true\n" >> /etc.supervisord.conf | |
| RUN echo "stderr_logfile=/dev/stderr\n" >> /etc.supervisord.conf | |
| RUN echo "stderr_logfile_maxbytes=1MB\n" >> /etc.supervisord.conf | |
| RUN echo "stdout_logfile=/dev/stdout\n" >> /etc.supervisord.conf | |
| RUN echo "stdout_logfile_maxbytes=1MB\n" >> /etc/supervisord.conf | |
| RUN echo "[program:streamlit_app]\n" >> /etc/supervisord.conf | |
| RUN echo "command=streamlit run streamlit_app.py --server.port 7860 --server.address 0.0.0.0\n" >> /etc.supervisord.conf # Streamlit default port 8501, but HF Spaces often uses 7860 | |
| RUN echo "directory=/app\n" >> /etc.supervisord.conf | |
| RUN echo "autostart=true\n" >> /etc.supervisord.conf | |
| RUN echo "autorestart=true\n" >> /etc.supervisord.conf | |
| RUN echo "stderr_logfile=/dev/stderr\n" >> /etc.supervisord.conf | |
| RUN echo "stderr_logfile_maxbytes=1MB\n" >> /etc.supervisord.conf | |
| RUN echo "stdout_logfile=/dev/stdout\n" >> /etc.supervisord.conf | |
| RUN echo "stdout_logfile_maxbytes=1MB\n" >> /etc.supervisord.conf | |
| # Expose the Streamlit port (Hugging Face Spaces expects 7860 for Streamlit) | |
| EXPOSE 7860 | |
| # Expose the Flask port (used internally within Docker, adjust if exposed externally) | |
| EXPOSE 5000 | |
| # Command to run supervisord | |
| CMD ["/usr/local/bin/supervisord", "-c", "/etc/supervisord.conf"] | |