Spaces:
Sleeping
Sleeping
| FROM continuumio/anaconda3:main | |
| WORKDIR /code | |
| COPY ./environment.yml /code/environment.yml | |
| # Create the environment using the environment.yml file | |
| RUN conda env create -f /code/environment.yml | |
| # install pip packages to the gradio environment | |
| # when adjusting the dockerfile on huggingface: | |
| # - if the dockerfile is successfully compileds, a new space need to be initialized and push the changes accordingly | |
| # - otherwise, you can commit to the failed build dockerfile for debugging | |
| RUN conda run -n gradio pip install --upgrade pip | |
| # RUN conda run -n gradio pip install diffusers["torch"] transformers accelerate xformers | |
| # RUN conda run -n gradio pip install gradio | |
| # RUN conda run -n gradio pip install controlnet-aux | |
| # RUN conda install -n gradio pytorch3d -c pytorch3d -c conda-forge | |
| # RUN conda install -n gradio -c conda-forge open-clip-torch pytorch-lightning | |
| # RUN conda run -n gradio pip install trimesh xatlas scikit-learn opencv-python omegaconf | |
| # Set the environment variable to use the gradio environment by default | |
| # RUN echo "source activate gradio" > ~/.bashrc | |
| # ENV PATH /opt/conda/envs/gradio/bin:$PATH | |
| # Set up a new user named "user" with user ID 1000 | |
| RUN useradd -m -u 1000 user | |
| # Switch to the "user" user | |
| USER user | |
| RUN conda create -n gradio-user python=3.11 | |
| RUN conda run -n gradio-user pip install --upgrade pip | |
| RUN conda install -n gradio-user pytorch3d=0.7.7 -c pytorch3d -c conda-forge | |
| RUN conda install -n gradio-user -c conda-forge open-clip-torch pytorch-lightning | |
| RUN conda run -n gradio-user pip install diffusers["torch"] transformers accelerate xformers controlnet-aux gradio trimesh xatlas scikit-learn opencv-python omegaconf | |
| # Set home to the user's home directory | |
| ENV HOME=/home/user \ | |
| PYTHONPATH=$HOME/app \ | |
| PYTHONUNBUFFERED=1 \ | |
| GRADIO_ALLOW_FLAGGING=never \ | |
| GRADIO_SERVER_NAME=0.0.0.0 \ | |
| GRADIO_THEME=huggingface \ | |
| SYSTEM=spaces | |
| # Set the working directory to the user's home directory | |
| WORKDIR $HOME/app | |
| # Copy the current directory contents into the container at $HOME/app setting the owner to the user | |
| COPY --chown=user . $HOME/app | |
| CMD ["./run.sh"] |