Skip to content

Commit

Permalink
[docker] refs #27 Improve documentation
Browse files Browse the repository at this point in the history
- Unomment stage to build others tags only if branch is `develop`
  • Loading branch information
stdevYuniers committed Dec 15, 2018
1 parent 6fbfca3 commit 8fb1c71
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 7 deletions.
51 changes: 48 additions & 3 deletions docker/images/dev-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,21 @@ $ docker run --rm \

### Use Visual Studio Code

In order to use Visual Studio Code on development, please read carefull
In order to use Visual Studio Code on development process, please read carefull
the [documentation of oficial Skycoin Visual Studio Code dev image](https://github.com/skycoin/skycoin/tree/develop/docker/images/dev-vscode#initialize-your-development-environment)

#### Installed extensions

- [C#](https://marketplace.visualstudio.com/items?itemName=ms-vscode.csharp)
- [C# FixFormat](https://marketplace.visualstudio.com/items?itemName=Leopotam.csharpfixformat)
- [C# Extensions](https://marketplace.visualstudio.com/items?itemName=jchannon.csharpextensions)
- [C# XML Documentation Comments](https://marketplace.visualstudio.com/items?itemName=k--kato.docomment)
- [.NET Core Tools](https://marketplace.visualstudio.com/items?itemName=formulahendry.dotnet)

#### Add extensions to Visual Studio Code

Like Skycoin Visual Studio Code dev image, you must pass `VS_EXTENSIONS` environment variable
to the command-line with extensions you prefer.
to the command-line with extensions you prefer. **Pass it if you use a docker image with Visual Studio Code**

```sh
$ docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix \
Expand All @@ -68,4 +76,41 @@ $ docker run --rm -it -v /tmp/.X11-unix:/tmp/.X11-unix \

### Build your own images

To be filled
The following arguments influence the Docker build process.

- `IMAGE_FROM`: base image used to build libskycoin-dotnet
- `SOURCE_COMMIT`: the SHA1 hash of the commit being tested.
- `IMAGE_NAME`: the name and tag of the Docker repository being built.
- `DOCKERFILE_PATH`: the dockerfile currently being built.
- `VS_EXTENSIONS` Visual Studio Code extensions to add on docker image.

For instance, the following commands can be executed in order to build using `skycoindev-cli:develop` as base image. **Pay attention, you can't use `VS_EXTENSIONS` build arg when base image is only for CLI purpose**

```sh
$ git clone https://github.com/simelo/libskycoin-dotnet.git && cd libskycoin-dotnet
$ IMAGE_FROM="skycoin/skycoindev-cli:develop"
$ SOURCE_COMMIT=$(git rev-parse HEAD)
$ IMAGE_NAME=simelotech/libskycoin-dotnet:develop
$ DOCKERFILE_PATH=docker/images/dev-cli/Dockerfile
$ docker build --build-arg IMAGE_FROM=$IMAGE_FROM \
--build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg SCOMMIT=$SOURCE_COMMIT \
-f $DOCKERFILE_PATH \
-t "$IMAGE_NAME" .
```

If you want use Visual Studio Code as IDE, yo can change `IMAGE_FROM` to build it. **When base image use Visual Studio Code, you can use `VS_EXTENSIONS` build arg**

```sh
$ git clone https://github.com/simelo/libskycoin-dotnet.git && cd libskycoin-dotnet
$ IMAGE_FROM="simelotech/skycoindev-vscode:develop"
$ SOURCE_COMMIT=$(git rev-parse HEAD)
$ IMAGE_NAME=simelotech/libskycoin-dotnet:vscode
$ DOCKERFILE_PATH=docker/images/dev-cli/Dockerfile
$ docker build --build-arg IMAGE_FROM=$IMAGE_FROM \
--build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg SCOMMIT=$SOURCE_COMMIT \
--build-arg VS_EXTENSIONS="ms-vscode.Go windmilleng.vscode-go-autotest" \
-f $DOCKERFILE_PATH \
-t "$IMAGE_NAME" .
```
4 changes: 2 additions & 2 deletions docker/images/dev-cli/hooks/build
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ docker build --build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \

# Build :dind, :vscode and :vscode-dind tag
# Only build if
# if [ "$CACHE_TAG" -eq "develop" ]; then
if [ "$CACHE_TAG" -eq "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 All @@ -42,4 +42,4 @@ docker build --build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \
--build-arg VS_EXTENSIONS="ms-vscode.csharp Leopotam.csharpfixformat jchannon.csharpextensions" \
-f $DOCKERFILE_PATH \
-t "$DOCKER_REPO:vscode-dind" .
# fi
fi
4 changes: 2 additions & 2 deletions docker/images/dev-cli/hooks/push
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

docker push $IMAGE_NAME

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

0 comments on commit 8fb1c71

Please sign in to comment.