Spaces:
Configuration error
Configuration error
Commit
·
8b2742a
1
Parent(s):
0e41be2
Create Dockerfile
Browse files- Dockerfile +62 -0
Dockerfile
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM python:3.8
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
RUN apt-get update && apt-get install --no-install-recommends -y \
|
| 5 |
+
build-essential \
|
| 6 |
+
# python3.8 \
|
| 7 |
+
# python3-pip \
|
| 8 |
+
# python3-setuptools \
|
| 9 |
+
git \
|
| 10 |
+
wget \
|
| 11 |
+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
|
| 12 |
+
|
| 13 |
+
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
| 14 |
+
|
| 15 |
+
WORKDIR /code
|
| 16 |
+
|
| 17 |
+
RUN useradd -m -u 1000 user
|
| 18 |
+
|
| 19 |
+
# Switch to the "user" user
|
| 20 |
+
USER user
|
| 21 |
+
# Set home to the user's home directory
|
| 22 |
+
ENV HOME=/home/user \
|
| 23 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 24 |
+
PYTHONPATH=$HOME/app \
|
| 25 |
+
PYTHONUNBUFFERED=1 \
|
| 26 |
+
GRADIO_ALLOW_FLAGGING=never \
|
| 27 |
+
GRADIO_NUM_PORTS=1 \
|
| 28 |
+
GRADIO_SERVER_NAME=0.0.0.0 \
|
| 29 |
+
GRADIO_THEME=huggingface \
|
| 30 |
+
SYSTEM=spaces
|
| 31 |
+
|
| 32 |
+
# RUN conda install python=3.8
|
| 33 |
+
|
| 34 |
+
RUN pip install setuptools-rust
|
| 35 |
+
RUN pip install torch==1.11.0+cu115 torchvision==0.12.0+cu115 --extra-index-url https://download.pytorch.org/whl/cu115
|
| 36 |
+
RUN pip install gradio scikit-image pillow openmim
|
| 37 |
+
RUN pip install --upgrade setuptools
|
| 38 |
+
|
| 39 |
+
WORKDIR /home/user
|
| 40 |
+
|
| 41 |
+
RUN --mount=type=secret,id=git_token,mode=0444,required=true \
|
| 42 |
+
git clone --branch mmseg-only https://$(cat /run/secrets/git_token)@github.com/NASA-IMPACT/hls-foundation-os.git
|
| 43 |
+
|
| 44 |
+
|
| 45 |
+
WORKDIR hls-foundation-os
|
| 46 |
+
|
| 47 |
+
RUN git checkout 9968269915db8402bf4a6d0549df9df57d489e5a
|
| 48 |
+
|
| 49 |
+
RUN pip install -e .
|
| 50 |
+
|
| 51 |
+
RUN mim install mmcv-full==1.6.2 -f https://download.openmmlab.com/mmcv/dist/11.5/1.11.0/index.html
|
| 52 |
+
|
| 53 |
+
# Set the working directory to the user's home directory
|
| 54 |
+
WORKDIR $HOME/app
|
| 55 |
+
|
| 56 |
+
# ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/code/miniconda/lib"
|
| 57 |
+
|
| 58 |
+
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
|
| 59 |
+
|
| 60 |
+
COPY --chown=user . $HOME/app
|
| 61 |
+
|
| 62 |
+
CMD ["python3", "app.py"]
|