From b40fdc98de9dbe819fed9b5198aaee4eaf73203d Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 22 Nov 2021 18:25:57 +0100 Subject: [PATCH] adding version metadata to docker build --- .github/workflows/release-selfhost.yml | 8 ++++++-- hosting/scripts/linux/release-to-docker-hub.sh | 7 ------- package.json | 2 +- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 5 files changed, 9 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release-selfhost.yml b/.github/workflows/release-selfhost.yml index 7ec2725a7f..61f3017457 100644 --- a/.github/workflows/release-selfhost.yml +++ b/.github/workflows/release-selfhost.yml @@ -27,15 +27,19 @@ jobs: aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} aws-region: eu-west-1 + - name: 'Get Previous tag' + id: previoustag + uses: "WyriHaximus/github-action-get-previous-tag@v1" + - name: Build/release Docker images (Self Host) run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build - yarn build:docker:production + yarn build:docker:selfhost env: DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} - BUDIBASE_RELEASE_VERSION: latest + BUDIBASE_RELEASE_VERSION: ${{ steps.previoustag.outputs.tag }} - uses: azure/setup-helm@v1 id: install diff --git a/hosting/scripts/linux/release-to-docker-hub.sh b/hosting/scripts/linux/release-to-docker-hub.sh index ccb5fa09a0..642a8682fb 100755 --- a/hosting/scripts/linux/release-to-docker-hub.sh +++ b/hosting/scripts/linux/release-to-docker-hub.sh @@ -1,7 +1,6 @@ #!/bin/bash tag=$1 -production=$2 if [[ ! "$tag" ]]; then echo "No tag present. You must pass a tag to this script" @@ -13,11 +12,5 @@ echo "Tagging images with tag: $tag" docker tag app-service budibase/apps:$tag docker tag worker-service budibase/worker:$tag -if [[ "$production" ]]; then - echo "Production Deployment. Tagging latest.." - docker tag app-service budibase/apps:latest - docker tag worker-service budibase/worker:latest -fi - docker push --all-tags budibase/apps docker push --all-tags budibase/worker diff --git a/package.json b/package.json index eb7b7167f1..773072063f 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "test:e2e": "lerna run cy:test", "test:e2e:ci": "lerna run cy:ci", "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", - "build:docker:production": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION release && cd -", + "build:docker:selfhost": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh latest && cd -", "build:docker:develop": "node scripts/pinVersions && lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "release:helm": "./scripts/release_helm_chart.sh", "env:multi:enable": "lerna run env:multi:enable", diff --git a/packages/server/package.json b/packages/server/package.json index 1c1e469e5f..d6999fdb38 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -14,7 +14,7 @@ "test": "jest --coverage --maxWorkers=2", "test:watch": "jest --watch", "predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client", - "build:docker": "yarn run predocker && docker build . -t app-service", + "build:docker": "yarn run predocker && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION", "run:docker": "node dist/index.js", "dev:stack:up": "node scripts/dev/manage.js up", "dev:stack:down": "node scripts/dev/manage.js down", diff --git a/packages/worker/package.json b/packages/worker/package.json index 91500c5112..8a7c27fa95 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -13,7 +13,7 @@ ], "scripts": { "run:docker": "node src/index.js", - "build:docker": "docker build . -t worker-service", + "build:docker": "docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION", "dev:stack:init": "node ./scripts/dev/manage.js init", "dev:builder": "npm run dev:stack:init && nodemon", "test": "jest --runInBand",