Download Dockerfile from Jofthomas/evBackend: direct link, hf CLI and curl.
- Browser
- Download file 1.44 kB
-
https://huggingface.co/spaces/Jofthomas/evBackend/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/Jofthomas/evBackend/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/Jofthomas/evBackend/resolve/main/Dockerfile
1.44 kB
| FROM nvidia/cuda:12.1.1-devel-ubuntu22.04 | |
| # FROM python:3.10.9 | |
| # Use a more secure method for setting the working directory | |
| WORKDIR /app | |
| # Copy the requirements file | |
| COPY ./requirements.txt /app/requirements.txt | |
| # Install dependencies (git needed to clone SoulForge below) | |
| RUN apt update && apt install -y python3 python3-pip git | |
| # Install all requirements first so pip is fully upgraded before SoulForge | |
| RUN python3 -m pip install --no-cache-dir --upgrade -r /app/requirements.txt | |
| # Install SoulForge: clone and copy the package directly into site-packages | |
| RUN git clone --depth=1 https://github.com/Jofthomas/SoulForge.git /tmp/soulforge \ | |
| && cp -r /tmp/soulforge/soulforge /usr/local/lib/python3.10/dist-packages/soulforge \ | |
| && rm -rf /tmp/soulforge | |
| RUN apt update && apt install -y ffmpeg | |
| # Add and configure the user | |
| RUN useradd -m -u 1000 user | |
| # Set environment variables for the user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH | |
| # Set the user and working directory | |
| USER user | |
| WORKDIR $HOME/app | |
| # Copy the application code | |
| COPY --chown=user . $HOME/app | |
| # Ensure the user has the correct permissions | |
| RUN chmod -R 777 $HOME/app | |
| # Set additional environment variables | |
| ENV NUMBA_CACHE_DIR=/tmp/NUMBA_CACHE_DIR/ | |
| ENV MPLCONFIGDIR=/tmp/MPLCONFIGDIR/ | |
| ENV HOME=/home/user | |
| ENV PATH="/opt/venv/bin:$PATH" | |
| # Set the command to run the application | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |