-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from simelo/stdevHan_t10_images_docker
Fixes #10 [docker] Virtualize workspaces for developers of Skycoin .NET apps
- Loading branch information
Showing
4 changed files
with
146 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
ARG IMAGE_FROM=skycoin/skycoindev-cli:develop | ||
FROM $IMAGE_FROM | ||
|
||
ARG BDATE | ||
ARG SCOMMIT | ||
|
||
# Image labels (see ./hooks/build for ARGS) | ||
LABEL "org.label-schema.name"="libskycoin-dotnet" \ | ||
"org.label-schema.description"="Docker image with mono, go, node and dev tools for libskycoin-dotnet developers" \ | ||
"org.label-schema.vendor"="Skycoin project" \ | ||
"org.label-schema.url"="skycoin.net" \ | ||
"org.label-schema.version"="0.1.0" \ | ||
"org.label-schema.schema-version"="1.0" \ | ||
"org.label-schema.build-date"=$BDATE \ | ||
"org.label-schema.vcs-url"="https://github.com/skycoin/libskycoin-dotnet.git" \ | ||
"org.label-schema.vcs-ref"=$SCOMMIT \ | ||
"org.label-schema.usage"="https://github.com/skycoin/libskycoin-dotnet/blob/"$SCOMMIT"/docker/images/dev-cli/README.md" \ | ||
"org.label-schema.docker.cmd"="mkdir src; docker run --rm -v ${PWD}/src:/usr/local/src skycoin/skycoindev-dotnet:develop git clone https://github.com/simelo/libskycoin-dotnet.git; sudo chown -R `whoami` src" | ||
|
||
ENV MONO_VERSION 4.8.0.524 | ||
ENV DEBIAN_FRONTEND noninteractive | ||
|
||
# Add mono debian repo and ins | ||
RUN apt update \ | ||
&& apt upgrade -y \ | ||
&& apt install -y curl \ | ||
apt-transport-https \ | ||
dirmngr \ | ||
&& apt-key adv --no-tty --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF \ | ||
&& echo "deb https://download.mono-project.com/repo/debian wheezy/snapshots/$MONO_VERSION main" > /etc/apt/sources.list.d/mono-official-stable.list \ | ||
&& apt update \ | ||
&& apt install -y \ | ||
binutils \ | ||
mono-devel \ | ||
ca-certificates-mono \ | ||
fsharp \ | ||
mono-vbnc \ | ||
nuget \ | ||
referenceassemblies-pcl \ | ||
&& apt clean \ | ||
&& rm -rf /var/lib/apt/lists/* /tmp/* | ||
|
||
WORKDIR $GOPATH/src/github.com/skycoin | ||
|
||
VOLUME $GOPATH/src/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
# Supported tags and respective `Dockerfile` links | ||
|
||
## Simple Tags | ||
|
||
- [`develop, dind, vscode, vscode-dind` (*docker/images/dev-cli/Dockerfile*)](https://github.com/simelo/libskycoin-dotnet/blob/develop/docker/images/dev-cli/Dockerfile) | ||
|
||
# Libskycoin .NET CLI development image | ||
|
||
This image has the necessary tools to build, test, edit, lint and version the Libskycoin .NET | ||
source code. It comes with Vim editor installed, along with some plugins | ||
to ease go development and version control with git. | ||
|
||
# How to use this image | ||
|
||
## Initialize your development environment. | ||
|
||
```sh | ||
$ mkdir src | ||
$ docker run --rm \ | ||
-v ${PWD}/src:/usr/local/src skycoin/skycoindev-dotnet:develop \ | ||
git clone https://github.com/simelo/libskycoin-dotnet.git \ | ||
$ sudo chown -R `whoami` src | ||
``` | ||
|
||
This downloads the libdotnet source to src/libdotnet 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 | ||
|
||
You can run commands by just passing the them to the image. Everything is run | ||
in a container and deleted when finished. | ||
|
||
### Running tests | ||
|
||
```sh | ||
$ docker run --rm \ | ||
-v ${PWD}/src:/usr/local/src simelotech/skycoindev-dotnet:develop \ | ||
sh -c "cd libskycoin-dotnet; make test" | ||
``` | ||
|
||
### Editing code | ||
|
||
```sh | ||
$ docker run --rm \ | ||
-v ${PWD}/src:/usr/local/src simelotech/skycoindev-dotnet:develop \ | ||
vim | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/bin/bash | ||
|
||
# This are the git ENV vars present at this point for the build process. | ||
# more on that in https://docs.docker.com/docker-cloud/builds/advanced | ||
# | ||
# SOURCE_BRANCH: the name of the branch or the tag that is currently being tested. | ||
# SOURCE_COMMIT: the SHA1 hash of the commit being tested. | ||
# COMMIT_MSG: the message from the commit being tested and built. | ||
# DOCKERFILE_PATH: the dockerfile currently being built. | ||
# DOCKER_REPO: the name of the Docker repository being built. | ||
# CACHE_TAG: the Docker repository tag being built. | ||
# IMAGE_NAME: the name and tag of the Docker repository being built. | ||
# (This variable is a combination of DOCKER_REPO:CACHE_TAG.) | ||
|
||
echo "Build hook running" | ||
|
||
# Build :develop tag | ||
docker build --build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ | ||
--build-arg SCOMMIT=$SOURCE_COMMIT \ | ||
-f $DOCKERFILE_PATH \ | ||
-t "$IMAGE_NAME" . | ||
|
||
# Build :dind, :vscode and :vscode-dind tag | ||
# Only build if | ||
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 \ | ||
-f $DOCKERFILE_PATH \ | ||
-t "$DOCKER_REPO:dind" . | ||
|
||
docker build --build-arg IMAGE_FROM="skycoin/skycoindev-vscode:develop" \ | ||
--build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ | ||
--build-arg SCOMMIT=$SOURCE_COMMIT \ | ||
-f $DOCKERFILE_PATH \ | ||
-t "$DOCKER_REPO:vscode" . | ||
|
||
docker build --build-arg IMAGE_FROM="skycoin/skycoindev-vscode:dind" \ | ||
--build-arg BDATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"` \ | ||
--build-arg SCOMMIT=$SOURCE_COMMIT \ | ||
-f $DOCKERFILE_PATH \ | ||
-t "$DOCKER_REPO:vscode-dind" . | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
docker push $IMAGE_NAME | ||
|
||
if [ "$CACHE_TAG" -eq "develop" ]; then | ||
docker push $DOCKER_REPO:dind | ||
docker push $DOCKER_REPO:vscode | ||
docker push $DOCKER_REPO:vscode-dind | ||
fi |