Skip to content

Commit

Permalink
[docker] refs skycoin#88 Fix conditional to build dind image
Browse files Browse the repository at this point in the history
- Mod Readme file with Docker instructions
  • Loading branch information
stdevYuniers committed Dec 27, 2018
1 parent c4b3a4a commit f60c1d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 18 deletions.
29 changes: 15 additions & 14 deletions docker/images/dev-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## Simple Tags

- [`develop` (*docker/images/dev/Dockerfile*)](https://github.com/simelo/pyskycoin/blob/develop/docker/images/dev/Dockerfile)
- [`dind` (*docker/images/dev/Dockerfile*)](https://github.com/simelo/pyskycoin/blob/develop/docker/images/dev/Dockerfile)
- [`develop` (*docker/images/dev/Dockerfile*)](https://github.com/simelo/pyskycoin/blob/develop/docker/images/dev/Dockerfile)
- [`dind` (*docker/images/dev/Dockerfile*)](https://github.com/simelo/pyskycoin/blob/develop/docker/images/dev/Dockerfile)

# Pyskycoin CLI/DIND development image
## Pyskycoin CLI/DIND development image

This image (CLI) has the necessary tools to build, test, edit, lint and version the Pyskycoin
source code. It comes with some versions of Python (2.7, 3.4, 3.5 and 3.6) and with Vim editor installed, along with some plugins
Expand All @@ -14,9 +14,9 @@ to ease go development and version control with git.
Besides it is possible to use Docker in Docker (DIND) Pyskycoin development image,
it is based on `skycoin/skycoindev-cli:dind` and provides all tools included in Pyskycoin CLI image.

# How to use this image
## How to use this image

## Initialize your development environment.
### Initialize your development environment.

```sh
$ mkdir src
Expand All @@ -30,36 +30,38 @@ This downloads the pyskycoin source to src/pyskycoin and changes the owner
to your user. This is necessary, because all processes inside the container run
as root and the files created by it are therefore owned by root.

## Running commands inside the container
### Running commands inside the container

You can run commands by just passing them to the image. Everything is run
in a container and deleted when finished.

### Running tests
#### Running tests

```sh
$ docker run --rm \
-v ${PWD}/src:/usr/local/src skycoin/skycoindev-python:develop \
sh -c "cd pyskycoin; make test"
```

### Editing code
#### Editing code

```sh
$ docker run --rm \
-v ${PWD}/src:/usr/local/src skycoin/skycoindev-python:develop \
vim
```

## How to use Docker in Docker image
### How to use Docker in Docker image

### Start a daemon instance
#### Start a daemon instance

```sh
$ docker run --privileged --name some-name -d skycoin/skycoindev-python:dind
$ docker run --privileged \
--name some-name \
-d skycoin/skycoindev-python:dind
```

### Where to store data
#### Where to store data

Create a data directory on the host system (outside the container) and mount this to a directory visible from inside the container.

Expand All @@ -74,7 +76,7 @@ $ docker run --privileged --name some-name \
-d skycoin/skycoindev-python:dind
```

# Build your own images
## Build your own images

The build process relies on the following parameters

Expand Down Expand Up @@ -116,4 +118,3 @@ and `master` branch on every push made after merging. The same process
is triggered for all feature branches matching the pattern
`/^([^_]+)_t([0-9]+)_.*docker.*/`. The tag generated for such images
will be of the form `feature-{\1}-{\2}`.

4 changes: 1 addition & 3 deletions docker/images/dev-cli/hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

echo "Build hook running"

pwd

# Build :develop tag
docker build --build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg SCOMMIT=$SOURCE_COMMIT \
Expand All @@ -25,7 +23,7 @@ docker build --build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
-t "$IMAGE_NAME" .

# Build :dind tag
if [ "$CACHE_TAG" -eq "develop" ]; then
if [ "$CACHE_TAG" == "develop" ]; then
docker build --build-arg IMAGE_FROM="skycoin/skycoindev-cli:dind" \
--build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg SCOMMIT=$SOURCE_COMMIT \
Expand Down
2 changes: 1 addition & 1 deletion docker/images/dev-cli/hooks/push
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

docker push $IMAGE_NAME

if [ "$CACHE_TAG" -eq "develop" ]; then
if [ "$CACHE_TAG" == "develop" ]; then
docker push $DOCKER_REPO:dind
fi

0 comments on commit f60c1d8

Please sign in to comment.