From c0e68b4ef6c26577c71e1e1a108c53618a8353c2 Mon Sep 17 00:00:00 2001 From: Tom Gallacher Date: Mon, 31 Oct 2016 17:09:00 +0000 Subject: [PATCH] ci: speedup docker builds and pushes --- Makefile | 2 +- bin/docker-login | 10 ++++++++++ bin/push-images | 28 ---------------------------- circle.yml | 4 +++- cloudapi-graphql/Makefile | 8 ++++++++ frontend/Makefile | 8 ++++++++ ui/Makefile | 8 ++++++++ 7 files changed, 38 insertions(+), 30 deletions(-) create mode 100755 bin/docker-login delete mode 100755 bin/push-images diff --git a/Makefile b/Makefile index 0a7715ce..5c919f75 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ check: -@./bin/setup SUBDIRS := $(dir $(wildcard */Makefile)) -TARGETS := install clean test test-ci lint lint-ci # whatever else, but must not contain '/' +TARGETS := install clean test test-ci lint lint-ci build push # whatever else, but must not contain '/' # foo/.all bar/.all foo/.clean bar/.clean SUBDIRS_TARGETS := \ diff --git a/bin/docker-login b/bin/docker-login new file mode 100755 index 00000000..4021d1f3 --- /dev/null +++ b/bin/docker-login @@ -0,0 +1,10 @@ +#! /usr/bin/env bash + +# +# Prelude - make bash behave sanely +# http://redsymbol.net/articles/unofficial-bash-strict-mode/ +# +set -euo pipefail + +echo ">> Logging into $_DOCKER_REGISTRY" +docker login -e="." -u="$_DOCKER_LOGIN_USERNAME" -p="$_DOCKER_LOGIN_PASSWORD" "$_DOCKER_REGISTRY" diff --git a/bin/push-images b/bin/push-images deleted file mode 100755 index 1c7ffd60..00000000 --- a/bin/push-images +++ /dev/null @@ -1,28 +0,0 @@ -#! /usr/bin/env bash - -# -# Prelude - make bash behave sanely -# http://redsymbol.net/articles/unofficial-bash-strict-mode/ -# -set -euo pipefail - -# Beware of CDPATH gotchas causing cd not to work correctly when a user -# has set this in their environment -# https://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/ -unset CDPATH - -readonly INCLUDE="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -# shellcheck source=bin/setup-tools -. "${INCLUDE}"/setup-tools - -echo ">> Logging into $_DOCKER_REGISTRY" -docker login -e="." -u="$_DOCKER_LOGIN_USERNAME" -p="$_DOCKER_LOGIN_PASSWORD" "$_DOCKER_REGISTRY" -echo ">> Installing captain" -curl -sSL https://raw.githubusercontent.com/tomgco/captain/master/install.sh | bash -export PATH=$HOME/.captain/bin:$PATH - -git stash -u -echo ">> running captain build" -captain build -N "$_DOCKER_REGISTRY/yldio/joyent-dashboard-" -echo ">> running captain push" -captain push -N "$_DOCKER_REGISTRY/yldio/joyent-dashboard-" diff --git a/circle.yml b/circle.yml index 6d1ba847..7de892c7 100644 --- a/circle.yml +++ b/circle.yml @@ -34,7 +34,9 @@ deployment: production: # just a label; label names are completely up to you branch: master commands: - - ./bin/push-images + - ./bin/docker-login + - make -j2 build + - make -j2 push - ./bin/deploy ## Custom notifications diff --git a/cloudapi-graphql/Makefile b/cloudapi-graphql/Makefile index e5787eb2..8bdaf473 100644 --- a/cloudapi-graphql/Makefile +++ b/cloudapi-graphql/Makefile @@ -32,6 +32,14 @@ test-ci: start: yarn run start +.PHONY: build +build: + docker build -t quay.io/yldio/joyent-dashboard-$(NAME) . + +.PHONY: push +push: + docker push quay.io/yldio/joyent-dashboard-$(NAME) + .PHONY: lint lint: $(bindir)/eslint . diff --git a/frontend/Makefile b/frontend/Makefile index 5915ab92..a8040600 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -32,6 +32,14 @@ test-ci: compile: install NODE_ENV=production ./node_modules/.bin/webpack --config webpack/index.js +.PHONY: build +build: + docker build -t quay.io/yldio/joyent-dashboard-$(NAME) . + +.PHONY: push +push: + docker push quay.io/yldio/joyent-dashboard-$(NAME) + .PHONY: start start: node server diff --git a/ui/Makefile b/ui/Makefile index 0a4cf9ad..d37329b8 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -39,6 +39,14 @@ install-production: install compile: install NODE_ENV=production ./node_modules/.bin/webpack --config webpack/index.js +.PHONY: build +build: + docker build -t quay.io/yldio/joyent-dashboard-$(NAME) . + +.PHONY: push +push: + docker push quay.io/yldio/joyent-dashboard-$(NAME) + .PHONY: clean clean: @rm -rf node_modules