andreped commited on
Commit
27b15b3
2 Parent(s): f8e78b0 23accd0

Merge pull request #31 from andreped/huggingface

Browse files
Files changed (1) hide show
  1. Dockerfile +54 -0
Dockerfile ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker
2
+ # you will also find guides on how best to write your Dockerfile
3
+ FROM tensorflow/tensorflow:2.4.2-gpu
4
+
5
+ # fix for broken keys in Ubuntu-18.04
6
+ RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub
7
+
8
+ # install Python 3.7
9
+ RUN apt-get update && apt-get install -y --no-install-recommends software-properties-common \
10
+ libsm6 libxext6 libxrender-dev curl \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ RUN echo "**** Installing Python ****" && \
14
+ add-apt-repository ppa:deadsnakes/ppa && \
15
+ apt-get install -y build-essential python3.7 python3.7-dev python3-pip && \
16
+ curl -O https://bootstrap.pypa.io/get-pip.py && \
17
+ python3.7 get-pip.py && \
18
+ rm -rf /var/lib/apt/lists/*
19
+
20
+ WORKDIR /code
21
+
22
+ RUN apt-get update -y
23
+ RUN apt install git --fix-missing -y
24
+
25
+ # install dependencies
26
+ COPY ./demo/requirements.txt /code/demo/requirements.txt
27
+ RUN python3.7 -m pip install --no-cache-dir --upgrade -r /code/demo/requirements.txt
28
+
29
+ # Install wget
30
+ RUN apt install wget -y
31
+
32
+ # Set up a new user named "user" with user ID 1000
33
+ RUN useradd -m -u 1000 user
34
+
35
+ # Switch to the "user" user
36
+ USER user
37
+
38
+ # Set home to the user's home directory
39
+ ENV HOME=/home/user \
40
+ PATH=/home/user/.local/bin:$PATH
41
+
42
+ # Set the working directory to the user's home directory
43
+ WORKDIR $HOME/app
44
+
45
+ # Copy the current directory contents into the container at $HOME/app setting the owner to the user
46
+ COPY --chown=user . $HOME/app
47
+
48
+ # Download pretrained parenchyma model
49
+ #RUN wget "https://github.com/andreped/livermask/releases/download/trained-models-v1/model.h5"
50
+
51
+ # Download test sample
52
+ RUN wget https://github.com/VemundFredriksen/LungTumorMask/releases/download/0.0.1/lung_001.nii.gz
53
+
54
+ CMD ["python3.7", "demo/app.py"]