-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Dockerfile for HF space deployment
- Loading branch information
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
# 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 | ||
|
||
# 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 | ||
|
||
# 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 wget https://github.com/VemundFredriksen/LungTumorMask/releases/download/0.0.1/lung_001.nii.gz | ||
|
||
CMD ["python3.7", "demo/app.py"] |