From c8b8ddb67fd9fd83ca0af8ef0ca4f32713f1a058 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 29 Jan 2021 10:41:08 +0000 Subject: [PATCH] add support for staging image that gets built on master push --- .github/workflows/budibase_ci.yml | 9 +++++++++ hosting/scripts/linux/release-to-docker-hub.sh | 10 ++++++++-- package.json | 3 ++- 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index e03768a420..ccbfa3ae24 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -34,3 +34,12 @@ jobs: CI: true name: Budibase CI - run: yarn test:e2e:ci + + - name: Build and Push Staging Docker Image + # Only run on push + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + run: yarn build:staging:docker + env: + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} + diff --git a/hosting/scripts/linux/release-to-docker-hub.sh b/hosting/scripts/linux/release-to-docker-hub.sh index b1921916e4..1661fed9f0 100755 --- a/hosting/scripts/linux/release-to-docker-hub.sh +++ b/hosting/scripts/linux/release-to-docker-hub.sh @@ -1,9 +1,15 @@ #!/bin/bash + +tag=$1 +tag=${tag:-latest} + pushd ../../build docker-compose build --force app-service docker-compose build --force worker-service -docker tag build_app-service budibase/budibase-apps:latest + +docker tag build_app-service budibase/budibase-apps:$tag +docker tag build_worker-service budibase/budibase-worker:$tag + docker push budibase/budibase-apps -docker tag build_worker-service budibase/budibase-worker:latest docker push budibase/budibase-worker popd diff --git a/package.json b/package.json index 37efca51ba..037e9c4b1c 100644 --- a/package.json +++ b/package.json @@ -33,6 +33,7 @@ "format": "prettier --write \"{,!(node_modules)/**/}*.{js,jsx,svelte}\"", "test:e2e": "lerna run cy:test", "test:e2e:ci": "lerna run cy:ci", - "build:docker": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -" + "build:docker": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -", + "build:docker:staging": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh staging && cd -" } }