From 36a32d796274333f662e99733f0e55c4fe4b3d03 Mon Sep 17 00:00:00 2001 From: Ruaridh Date: Fri, 30 Oct 2020 17:38:30 +0000 Subject: [PATCH] Automate docker build and upload (#703) * add basic master builds * fix branch name * tidy up * update to work from master --- .circleci/config.yml | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1e6a0a0..4d3f0c10 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -103,6 +103,24 @@ jobs: target: link-check description: "Check url links are not broken" + docker-build-and-push: + # adapted from: https://circleci.com/blog/using-circleci-workflows-to-replicate-docker-hub-automated-builds/ + environment: + IMAGE_NAME: kava/kava + docker: + - image: circleci/buildpack-deps:stretch + steps: + - checkout + - setup_remote_docker + - run: + name: Build Docker image + command: docker build -t $IMAGE_NAME:$CIRCLE_BRANCH . + - run: + name: Publish Docker Image to Docker Hub + command: | + echo "$DOCKERHUB_KEY" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + docker push $IMAGE_NAME:$CIRCLE_BRANCH + workflows: version: 2 @@ -126,4 +144,10 @@ workflows: only: "master" - broken-link-check: requires: - - setup-dependencies \ No newline at end of file + - setup-dependencies + upload-docker-images: + jobs: + - docker-build-and-push: + filters: + branches: + only: master \ No newline at end of file