ci: speedup docker builds and pushes

This commit is contained in:
Tom Gallacher 2016-10-31 17:09:00 +00:00
parent fdf1a4c508
commit c0e68b4ef6
7 changed files with 38 additions and 30 deletions

View File

@ -4,7 +4,7 @@ check:
-@./bin/setup -@./bin/setup
SUBDIRS := $(dir $(wildcard */Makefile)) 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 # foo/.all bar/.all foo/.clean bar/.clean
SUBDIRS_TARGETS := \ SUBDIRS_TARGETS := \

10
bin/docker-login Executable file
View File

@ -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"

View File

@ -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-"

View File

@ -34,7 +34,9 @@ deployment:
production: # just a label; label names are completely up to you production: # just a label; label names are completely up to you
branch: master branch: master
commands: commands:
- ./bin/push-images - ./bin/docker-login
- make -j2 build
- make -j2 push
- ./bin/deploy - ./bin/deploy
## Custom notifications ## Custom notifications

View File

@ -32,6 +32,14 @@ test-ci:
start: start:
yarn run 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 .PHONY: lint
lint: lint:
$(bindir)/eslint . $(bindir)/eslint .

View File

@ -32,6 +32,14 @@ test-ci:
compile: install compile: install
NODE_ENV=production ./node_modules/.bin/webpack --config webpack/index.js 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 .PHONY: start
start: start:
node server node server

View File

@ -39,6 +39,14 @@ install-production: install
compile: install compile: install
NODE_ENV=production ./node_modules/.bin/webpack --config webpack/index.js 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 .PHONY: clean
clean: clean:
@rm -rf node_modules @rm -rf node_modules