Skip to content

Commit

Permalink
Merge pull request #10 from gosha20777/dev
Browse files Browse the repository at this point in the history
Dev update makefile
  • Loading branch information
gosha20777 authored Jun 3, 2019
2 parents 466779c + b488a9c commit 5e2f344
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
3 changes: 1 addition & 2 deletions Dockerfile.gpu
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ ENV KERAS_BACKEND=tensorflow
RUN pip3 --no-cache-dir install --no-dependencies git+https://github.com/fchollet/keras.git@${KERAS_VERSION}

# quick test and dump package lists
RUN python3 -c "import tensorflow; print(tensorflow.__version__)" \
&& dpkg-query -l > /dpkg-query-l.txt \
RUN dpkg-query -l > /dpkg-query-l.txt \
&& pip3 freeze > /pip3-freeze.txt

# install application
Expand Down
47 changes: 47 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@

# Version for docker images from git
RLA_VERSION := $(shell git describe --abbrev=0 --tags)

# Build both docker images
.PHONY: build-all
build-all: build build-gpu


# Build docker image. Application using GPU (nvidia docker needed)
.PHONY: build-gpu
build-gpu:
docker build --file Dockerfile.gpu -t rescuer_la:$(RLA_VERSION)-gpu .

# Build docker image. Application using CPU
.PHONY: build
build:
docker build -t rescuer_la:$(RLA_VERSION) .

# Build and run docker image. Application using CPU
.PHONY: run
run: build
docker run --rm \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$(DISPLAY) \
--workdir=$(pwd) \
--volume="/home/$(USER):/home/$(USER)" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
rescuer_la:$(RLA_VERSION)

# Build and run docker image. Application using GPU
run-gpu: build-gpu
docker run --rm \
--runtime=nvidia \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-e DISPLAY=unix$(DISPLAY) \
--workdir=$(pwd) \
--volume="/home/$(USER):/home/$(USER)" \
--volume="/etc/group:/etc/group:ro" \
--volume="/etc/passwd:/etc/passwd:ro" \
--volume="/etc/shadow:/etc/shadow:ro" \
--volume="/etc/sudoers.d:/etc/sudoers.d:ro" \
rescuer_la:$(RLA_VERSION)-gpu

0 comments on commit 5e2f344

Please sign in to comment.