# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # you will also find guides on how best to write your Dockerfile # Use an official Python runtime as a parent image FROM python:3.9 # Set up a new user named "user" with user ID 1000 RUN useradd -m -u 1000 user # Switch to the "user" user USER user # Set home to the user's home directory ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH # Set the working directory in the container to /app WORKDIR $HOME/app # Add the current directory contents into the container at /app ADD . $HOME/app # Install any needed packages specified in requirements.txt RUN pip install --no-cache-dir -r requirements.txt # Copy the current directory contents into the container at $HOME/app setting the owner to the user COPY --chown=user . $HOME/app # # Expose the secret NOMIC_API_KEY at buildtime and use its value # RUN --mount=type=secret,id=NOMIC_API_KEY,mode=0444,required=true \ # nomic login $(cat /run/secrets/NOMIC_API_KEY) # Make port 7860 available to the world outside this container EXPOSE 7860 CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]