Spaces:
Runtime error
Runtime error
Download Dockerfile from AliHamza123/FlaskTesting: direct link, hf CLI and curl.
- Browser
- Download file 1.25 kB
-
https://huggingface.co/spaces/AliHamza123/FlaskTesting/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/AliHamza123/FlaskTesting/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/AliHamza123/FlaskTesting/resolve/main/Dockerfile
1.25 kB
| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the current directory contents into the container at /app | |
| ADD . /app | |
| # Install the necessary build tools | |
| RUN apt-get update && \ | |
| apt-get install -y gcc g++ python3-dev && \ | |
| apt-get clean | |
| # Create writable cache and surprise data directories | |
| RUN mkdir -p /app/.cache /app/.surprise_data /tmp | |
| # Set environment variables for cache directories | |
| ENV HF_HOME=/app/.cache | |
| ENV HF_DATASETS_CACHE=/app/.cache | |
| ENV TRANSFORMERS_CACHE=/app/.cache | |
| ENV SURPRISE_DATA_FOLDER=/app/.surprise_data | |
| # Update pip and install specific versions of numpy and other necessary packages | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir "numpy<2" && \ | |
| pip install --no-cache-dir -r requirements.txt | |
| # Ensure /tmp is writable, as the app will create the label encoder file there | |
| # Ensure the cache directory is writable | |
| # Ensure the cache directory is writable | |
| RUN mkdir -p /app/cache && chmod -R 777 /app/cache /tmp | |
| # Expose port 5016 for the Flask app | |
| EXPOSE 5016 | |
| # Run app.py when the container launches | |
| CMD ["gunicorn", "-b", "0.0.0.0:7860","app:app"] | |