-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile
59 lines (42 loc) · 1.92 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
# you will also find guides on how best to write your Dockerfile
FROM tensorflow/tensorflow:2.4.2-gpu
# fix for broken keys in Ubuntu-18.04
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
# install Python 3.7
RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common \
libsm6 libxext6 libxrender-dev curl \
&& rm -rf /var/lib/apt/lists/*
RUN echo "**** Installing Python ****" && \
add-apt-repository ppa:deadsnakes/ppa && \
apt-get install -y build-essential python3.7 python3.7-dev python3-pip && \
curl -O https://bootstrap.pypa.io/get-pip.py && \
python3.7 get-pip.py && \
rm -rf /var/lib/apt/lists/*
WORKDIR /code
RUN apt-get update -y
RUN apt install git --fix-missing -y
RUN ls -la
# install dependencies
COPY ./demo/requirements.txt /code/demo/requirements.txt
RUN python3.7 -m pip install --no-cache-dir --upgrade -r /code/demo/requirements.txt
# resolve issue with tf==2.4 and gradio dependency collision issue
RUN python3.7 -m pip install --force-reinstall typing_extensions==4.0.0
# Install wget
RUN apt install wget -y
# 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 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
# Download pretrained parenchyma model
RUN wget "https://github.com/andreped/livermask/releases/download/trained-models-v1/model.h5"
# Download test sample
RUN python3.7 -m pip install gdown && gdown "https://drive.google.com/uc?id=1shjSrFjS4PHE5sTku30PZTLPZpGu24o3"
CMD ["python3.7", "demo/app.py"]