Team Ai
Apppublic

VirtualLab/AutonomousResearcher

sourceHugging Faceupdated 2y agoView on Hugging Face
0likes
Dockerfile50 linesDownload Raw Back to root
1# Read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker2# you will also find guides on how best to write your Dockerfile3 4# Declare your environment variables with the ARG directive5## ARG MODEL_REPO_NAME6 7FROM python:latest8# [...]9# You can use them like environment variables10## RUN predict.py $MODEL_REPO_NAME11 12USER root13# Install sudo because models usually looks for it14RUN apt-get update && apt-get -y install sudo15 16# Set up a new user named "user" with user ID 100017RUN useradd -m -u 1000 user18 19# Switch to the "user" user20USER user21 22# Set home to the user's home directory23ENV HOME=/home/user \24	PATH=/home/user/.local/bin:$PATH25 26# Set the working directory to the user's home directory27WORKDIR $HOME/app28 29# Copy the current directory contents into the container at $HOME/app setting the owner to the user30COPY --chown=user . $HOME/app31 32# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python33RUN pip install --no-cache-dir --upgrade pip34 35# Install dependencies36RUN pip install --no-cache-dir -r requirements.txt37 38# Run as root39#USER root40 41EXPOSE 768042 43# Command to run the application on the default Hugging Face port44CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]45 46# Download a checkpoint47## RUN mkdir content48## ADD --chown=user https://<SOME_ASSET_URL> content/<SOME_ASSET_NAME>49 50