Skip to content

Commit

Permalink
adding Dockerfiles for building cpu and gpu images
Browse files Browse the repository at this point in the history
  • Loading branch information
jwdinius committed Aug 5, 2019
1 parent 6ab30a3 commit df1f20c
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 0 deletions.
23 changes: 23 additions & 0 deletions Dockerfile.cpu
@@ -0,0 +1,23 @@
# See all tag variants at https://hub.docker.com/r/tensorflow/tensorflow/tags/
# build with `ln -sf Dockerfile.cpu Dockerfile && docker build --network=host -t {container-name} .`
FROM tensorflow/tensorflow:latest-py3-jupyter

## modify below
ARG username=gdl
ARG groupid=1000
ARG userid=1000
## end modify

COPY ./requirements.txt /
RUN python3 -m pip install --upgrade pip
RUN pip install -r /requirements.txt

# -m option creates a fake writable home folder for Jupyter.
RUN groupadd -g $groupid $username \
&& useradd -m -r -u $userid -g $username $username
USER $username

VOLUME ["/GDL"]
WORKDIR /GDL

CMD ["jupyter", "notebook", "--no-browser", "--ip=0.0.0.0", "/GDL"]
25 changes: 25 additions & 0 deletions Dockerfile.gpu
@@ -0,0 +1,25 @@
# See all tag variants at https://hub.docker.com/r/tensorflow/tensorflow/tags/
# build with `ln -sf Dockerfile.gpu Dockerfile && docker build --network=host -t {container-name} .`
# NOTE(jwd) - if you wish to use this implementation, you must install nvidia-docker v2.0
# see https://github.com/nvidia/nvidia-docker/wiki/Installation-(version-2.0) for steps
FROM tensorflow/tensorflow:latest-gpu-py3-jupyter

## modify below
ARG username=gdl
ARG groupid=1000
ARG userid=1000
## end modify

COPY ./requirements.txt /
RUN python3 -m pip install --upgrade pip
RUN pip install -r /requirements.txt

# -m option creates a fake writable home folder for Jupyter.
RUN groupadd -g $groupid $username \
&& useradd -m -r -u $userid -g $username $username
USER $username

VOLUME ["/GDL"]
WORKDIR /GDL

CMD ["jupyter", "notebook", "--no-browser", "--ip=0.0.0.0", "/GDL"]
2 changes: 2 additions & 0 deletions launch-docker-cpu.sh
@@ -0,0 +1,2 @@
# USAGE - ./launch-docker-cpu.sh {abs-path-to-GDL-code}
docker run --rm --network=host -it -v $1:/GDL gdl-image-cpu
2 changes: 2 additions & 0 deletions launch-docker-gpu.sh
@@ -0,0 +1,2 @@
# USAGE - ./launch-docker-gpu.sh {abs-path-to-GDL-code}
docker run --rm --runtime=nvidia --network=host -it -v $1:/GDL gdl-image

0 comments on commit df1f20c

Please sign in to comment.