From f60c1d81287fb17f02fa3e5fa815e20d364d7c1d Mon Sep 17 00:00:00 2001 From: stdevYuniers Date: Wed, 26 Dec 2018 23:08:12 -0500 Subject: [PATCH 1/2] [docker] refs #88 Fix conditional to build dind image - Mod Readme file with Docker instructions --- docker/images/dev-cli/README.md | 29 +++++++++++++++-------------- docker/images/dev-cli/hooks/build | 4 +--- docker/images/dev-cli/hooks/push | 2 +- 3 files changed, 17 insertions(+), 18 deletions(-) diff --git a/docker/images/dev-cli/README.md b/docker/images/dev-cli/README.md index e856c5b9..a6ef9f15 100644 --- a/docker/images/dev-cli/README.md +++ b/docker/images/dev-cli/README.md @@ -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 @@ -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 @@ -30,12 +30,12 @@ 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 \ @@ -43,7 +43,7 @@ $ docker run --rm \ sh -c "cd pyskycoin; make test" ``` -### Editing code +#### Editing code ```sh $ docker run --rm \ @@ -51,15 +51,17 @@ $ docker run --rm \ 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. @@ -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 @@ -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}`. - diff --git a/docker/images/dev-cli/hooks/build b/docker/images/dev-cli/hooks/build index 326e811e..6e0402c0 100644 --- a/docker/images/dev-cli/hooks/build +++ b/docker/images/dev-cli/hooks/build @@ -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 \ @@ -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 \ diff --git a/docker/images/dev-cli/hooks/push b/docker/images/dev-cli/hooks/push index f9e243fc..ca2ad1ab 100644 --- a/docker/images/dev-cli/hooks/push +++ b/docker/images/dev-cli/hooks/push @@ -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 From 28e12bd485078b2e42886d222cc487a6d2584bb0 Mon Sep 17 00:00:00 2001 From: stdevYuniers Date: Thu, 27 Dec 2018 07:31:44 -0500 Subject: [PATCH 2/2] [docker] refs #88 Add '--no-tty' option to gpg --- docker/images/dev-cli/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docker/images/dev-cli/Dockerfile b/docker/images/dev-cli/Dockerfile index 8caf6c53..fa7c7e71 100644 --- a/docker/images/dev-cli/Dockerfile +++ b/docker/images/dev-cli/Dockerfile @@ -62,7 +62,7 @@ RUN set -ex \ hkp://p80.pool.sks-keyservers.net:80 \ keyserver.ubuntu.com \ hkp://keyserver.ubuntu.com:80 ;do\ - gpg --keyserver "$server" --recv-keys 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D;done \ + gpg --no-tty --keyserver "$server" --recv-keys 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D;done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf "$GNUPGHOME" python.tar.xz.asc \ && mkdir -p /usr/src/python \ @@ -111,7 +111,7 @@ RUN set -ex \ hkp://p80.pool.sks-keyservers.net:80 \ keyserver.ubuntu.com \ hkp://keyserver.ubuntu.com:80 ;do\ - gpg --keyserver "$server" --recv-keys 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D;done \ + gpg --no-tty --keyserver "$server" --recv-keys 0D96DF4D4110E5C43FBFB17F2D347EA6AA65421D;done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf "$GNUPGHOME" python.tar.xz.asc \ && mkdir -p /usr/src/python \ @@ -157,7 +157,7 @@ RUN set -ex \ hkp://p80.pool.sks-keyservers.net:80 \ keyserver.ubuntu.com \ hkp://keyserver.ubuntu.com:80 ;do\ - gpg --keyserver "$server" --recv-keys 97FC712E4C024BBEA48A61ED3A5CA953F73C700D;done \ + gpg --no-tty --keyserver "$server" --recv-keys 97FC712E4C024BBEA48A61ED3A5CA953F73C700D;done \ && gpg --batch --verify python.tar.xz.asc python.tar.xz \ && rm -rf "$GNUPGHOME" python.tar.xz.asc \ && mkdir -p /usr/src/python \