Spaces:
Sleeping
Sleeping
Download Dockerfile from nisaralll/Knowledge_forge: direct link, hf CLI and curl.
- Browser
- Download file 980 Bytes
-
https://huggingface.co/spaces/nisaralll/Knowledge_forge/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/nisaralll/Knowledge_forge/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/nisaralll/Knowledge_forge/resolve/main/Dockerfile
980 Bytes
| # --- Build Stage --- | |
| # Use a full Python image to build dependencies | |
| FROM docker.io/library/python:3.10 as builder | |
| WORKDIR /opt/ | |
| # Create a virtual environment | |
| RUN python -m venv venv | |
| # Activate the venv and install packages | |
| COPY requirements.txt . | |
| RUN . /opt/venv/bin/activate && pip install --no-cache-dir -r requirements.txt | |
| # --- Final Stage --- | |
| # Use a slim image for the final container | |
| FROM docker.io/library/python:3.10-slim | |
| WORKDIR /app | |
| # Copy the virtual environment from the builder stage | |
| COPY --from=builder /opt/venv /opt/venv | |
| # Copy the application code | |
| COPY . . | |
| # Set the PATH to use the venv's Python and packages | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| # Set the cache directory for Hugging Face models | |
| ENV HF_HOME=/app/cache/ | |
| # --- ADD THIS LINE --- | |
| # Create the cache directory and make it writable | |
| RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
| # Expose the port and run the application | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"] |