Spaces:
Runtime error
Runtime error
| # Use an NVIDIA CUDA base image | |
| ARG CUDA_IMAGE="12.1.1-cudnn8-devel-ubuntu22.04" | |
| FROM nvidia/cuda:${CUDA_IMAGE} | |
| ENV HOST 0.0.0.0 | |
| # Set the working directory in the container to /app | |
| #WORKDIR /app | |
| RUN mkdir -p /app/cache && chmod -R 777 /app/cache | |
| ENV HF_HOME=/app/cache | |
| # Install Python and pip | |
| RUN apt-get update && apt-get install --no-install-recommends -y \ | |
| build-essential \ | |
| python3.9 \ | |
| python3-pip \ | |
| git \ | |
| ffmpeg \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| # Copy the current directory contents into the container at /app | |
| COPY . /app | |
| # Install required packages from requirements.txt | |
| COPY ./requirements.txt /app/requirements.txt | |
| RUN pip3 install --no-cache-dir -r /app/requirements.txt | |
| # Expose the ports for FastAPI and Streamlit | |
| EXPOSE 8000 | |
| EXPOSE 8501 | |
| # Copy and give execute permissions to the start script | |
| COPY start_server.sh /app/start_server.sh | |
| RUN chmod +x /app/start_server.sh | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| WORKDIR /home/user/app | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:$PATH \ | |
| PYTHONPATH=$HOME/app \ | |
| PYTHONUNBUFFERED=1 \ | |
| GRADIO_ALLOW_FLAGGING=never \ | |
| GRADIO_NUM_PORTS=1 \ | |
| GRADIO_SERVER_NAME=0.0.0.0 \ | |
| GRADIO_THEME=huggingface \ | |
| SYSTEM=spaces | |
| # Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
| COPY --chown=user . /home/user/app | |
| # Run the start script | |
| #CMD ["/app/start_server.sh"] | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8000"] |