add docker build image;

This commit is contained in:
guyfedwards
2018-08-16 10:09:04 +01:00
committed by Bryan Boreham
parent fc7e5bf9f8
commit 9efcea41b9
2 changed files with 49 additions and 37 deletions

View File

@@ -4,19 +4,42 @@ defaults: &defaults
environment:
GOPATH: /home/ubuntu
SRCDIR: /home/ubuntu/src/github.com/weaveworks/scope
PATH: $PATH:$HOME/.local/bin
CLOUDSDK_CORE_DISABLE_PROMPTS: 1
SCOPE_UI_BUILD: $HOME/docker/scope_ui_build.tar
IMAGES: scope cloud-agent
docker:
image: weaveworks/scope-build-image:latest
workflows:
version: 2
test_and_deploy:
jobs:
- build:
filters:
branches:
ignore: gh-pages
- deploy:
filters:
branches:
only: master
requires:
- build
- deploy-dev:
filters:
branches:
ignore: master
requires:
- build
jobs:
build:
<<: *defaults
machine: true
steps:
- checkout
- run: curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
# PATH must be set here as circle currently does not support string interpolation
# for environment
# https://discuss.circleci.com/t/bin-sh-mkdir-command-not-found/8710
- run: export PATH="$PATH:$HOME/.local/bin"
- run: pip install --upgrade requests
- run: |
sudo apt-get update &&
@@ -59,6 +82,10 @@ jobs:
machine: true
steps:
- checkout
# PATH must be set here as circle currently does not support string interpolation
# for environment
# https://discuss.circleci.com/t/bin-sh-mkdir-command-not-found/8710
- run: export PATH="$PATH:$HOME/.local/bin"
- run: |
test -z "${DOCKER_USER}" || (
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS &&
@@ -86,42 +113,13 @@ jobs:
machine: true
steps:
- checkout
# PATH must be set here as circle currently does not support string interpolation
# for environment
# https://discuss.circleci.com/t/bin-sh-mkdir-command-not-found/8710
- run: export PATH="$PATH:$HOME/.local/bin"
- run: >
test -z "${DEPLOY_BRANCH}" || test -z "${DOCKER_USER}" || (
docker login -e $DOCKER_EMAIL -u $DOCKER_USER -p $DOCKER_PASS &&
docker tag weaveworks/scope:latest ${DOCKER_ORGANIZATION:-$DOCKER_USER}/scope:${CIRCLE_BRANCH//\//-} &&
docker push ${DOCKER_ORGANIZATION:-$DOCKER_USER}/scope:${CIRCLE_BRANCH//\//-}
)
workflows:
version: 2
test_and_deploy:
jobs:
- build:
filters:
branches:
ignore: gh-pages
- deploy:
filters:
branches:
only: master
requires:
- build
- deploy-dev:
filters:
branches:
ignore: master
requires:
- build
# release:
# branch: /release-[0-9]+\.[0-9]+/
# owner: weaveworks
# commands:
# - go get github.com/weaveworks/wordepress && cd /home/ubuntu/src/github.com/weaveworks/wordepress && git checkout v1.0.0 && cd cmd/wordepress && go get
# - cd $SRCDIR; PRODUCT=scope tools/publish-site "$WP_LIVE_URL" "$WP_LIVE_USER" "$WP_LIVE_PASSWORD"
# issues:
# branch: /.*/
# owner: weaveworks
# commands:
# - go get github.com/weaveworks/wordepress && cd /home/ubuntu/src/github.com/weaveworks/wordepress && git checkout v1.0.0 && cd cmd/wordepress && go get
# - cd $SRCDIR; PRODUCT=scope tools/publish-site "$WP_DEV_URL" "$WP_DEV_USER" "$WP_DEV_PASSWORD"

14
build-image/Dockerfile Normal file
View File

@@ -0,0 +1,14 @@
FROM golang:1.10.1-stretch
RUN apt-get update && apt-get install jq pv \
&& chmod a+wr --recursive /usr/local/go/pkg \
&& (curl https://sdk.cloud.google.com | bash) \
&& pip install --upgrade requests awscli
ARG revision
LABEL maintainer="Weaveworks <help@weave.works>" \
org.opencontainers.image.title="build-image" \
org.opencontainers.image.source="https://github.com/weaveworks/scope/tree/master/build-image" \
org.opencontainers.image.revision="${revision}" \
org.opencontainers.image.vendor="Weaveworks"