Skip to content
This repository has been archived by the owner on Oct 29, 2020. It is now read-only.

Commit

Permalink
Merge pull request #87 from NeuroDataDesign/satish
Browse files Browse the repository at this point in the history
Update Docker Build Scripts for DockerHub
  • Loading branch information
tpsatish95 committed Dec 9, 2018
2 parents cbc27f8 + 97e5c84 commit 3478b0c
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ python3 setup.py install
## Setting up the development environment:
- To build image and run from scratch:
- Install [docker](https://docs.docker.com/install/)
- Build the docker image, `docker build -t mgcpy-dev:latest .`
- Build the docker image, `docker build -t mgcpy:latest .`
- This takes 20-30 mins to build
- Launch the container to go into mgcpy's dev env, `docker run -it --rm --name mgcpy-dev-env mgcpy-dev`
- Pull master branch image from Dockerhub and run:
- `docker pull tpsatish95/mgcpy-dev:latest`
- `docker run -it --rm -p 8888:8888 --name mgcpy-dev-env tpsatish95/mgcpy-dev`
- Launch the container to go into mgcpy's dev env, `docker run -it --rm --name mgcpy-env mgcpy:latest`
- Pull image from Dockerhub and run:
- `docker pull tpsatish95/mgcpy:latest` or `docker pull tpsatish95/mgcpy:development`
- `docker run -it --rm -p 8888:8888 --name mgcpy-env tpsatish95/mgcpy:latest`


- To run demo notebooks (from within Docker):
Expand All @@ -49,7 +49,7 @@ python3 setup.py install
- Then open `mgc.ipynb`

- To mount/load local files into docker container:
- Do `docker run -it --rm -v <local_dir_path>:/root/workspace/ -p 8888:8888 --name mgcpy-dev-env tpsatish95/mgcpy-dev`, replace `<local_dir_path>` with your local dir path.
- Do `docker run -it --rm -v <local_dir_path>:/root/workspace/ -p 8888:8888 --name mgcpy-env tpsatish95/mgcpy:latest`, replace `<local_dir_path>` with your local dir path.
- Do `cd ../workspace` when you are inside the container to view the mounted files. The **mgcpy** package code will be in `/root/code` directory.


Expand Down
12 changes: 12 additions & 0 deletions hooks/build
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash -xe

. ./hooks/env

docker build \
--build-arg BUILD_DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg "SOURCE_COMMIT=$GIT_SHA1" \
--build-arg "SOURCE_BRANCH=$SOURCE_BRANCH" \
--build-arg "DOCKERFILE_PATH=$DOCKERFILE_PATH" \
--build-arg "SOURCE_TYPE=$SOURCE_TYPE" \
${VERSION:+--build-arg "VERSION=$VERSION"} \
-t $IMAGE_NAME .
10 changes: 10 additions & 0 deletions hooks/env
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[ -n "$SOURCE_BRANCH" ] || SOURCE_BRANCH=$(git symbolic-ref -q --short HEAD)
[ -n "$GIT_SHA1" ] || GIT_SHA1=$(git rev-parse -q HEAD)

if [[ "${SOURCE_BRANCH/-*/}" =~ ^[0-9][0-9.]*$ ]]; then
VERSION=${SOURCE_BRANCH/-*/}
fi

[ -n "$SOURCE_TYPE" ] || SOURCE_TYPE=git
[ -n "$DOCKERFILE_PATH" ] || DOCKERFILE_PATH=.
[ -n "$IMAGE_NAME" ] || IMAGE_NAME=tpsatish95/mgcpy:${SOURCE_BRANCH}
File renamed without changes.
2 changes: 1 addition & 1 deletion install-hooks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

basedir=$(git rev-parse --show-toplevel)
repohookspath="$basedir/.git/hooks"
localhook="$basedir/git-hooks/pre-commit"
localhook="$basedir/hooks/pre-commit"

repohook="$repohookspath/pre-commit"

Expand Down

0 comments on commit 3478b0c

Please sign in to comment.