From a141598a1cb269ab5deb2b939a861a753d8b236d Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:26:28 +0100 Subject: [PATCH 01/10] Remove unused scripts --- package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/package.json b/package.json index d3f4903e6c..03257d2d06 100644 --- a/package.json +++ b/package.json @@ -56,8 +56,6 @@ "build:specs": "lerna run --stream specs", "build:docker": "lerna run --stream build:docker && yarn build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", "build:docker:proxy": "docker build hosting/proxy -t proxy-service", - "build:docker:selfhost": "lerna run --stream build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh latest && cd -", - "build:docker:develop": "node scripts/pinVersions && lerna run --stream build:docker && yarn build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "build:docker:airgap": "node hosting/scripts/airgapped/airgappedDockerBuild", "build:docker:airgap:single": "SINGLE_IMAGE=1 node hosting/scripts/airgapped/airgappedDockerBuild", "build:digitalocean": "cd hosting/digitalocean && ./build.sh && cd -", From 6631a7a11d8704a075bec9fc7516ccfb08aac141 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:34:55 +0100 Subject: [PATCH 02/10] Push docker images via docker/build-push-action --- .github/workflows/release-master.yml | 39 +++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 4c5a3f4a1e..a8af6a4da1 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -66,14 +66,47 @@ jobs: - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v1 - - name: Build/release Docker images + + - name: Docker login run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD - yarn build:docker env: DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} - BUDIBASE_RELEASE_VERSION: ${{ steps.currenttag.outputs.version }} + + - name: Build docker (budibase/worker) + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + build-args: | + BUDIBASE_VERSION=${{ env.BUDIBASE_VERSION }} + tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} + file: ./packages/worker/Dockerfile.v2 + cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest + cache-to: type=inline + env: + IMAGE_NAME: budibase/worker + IMAGE_TAG: ${{ inputs.image_tag }} + BUDIBASE_VERSION: ${{ steps.currenttag.outputs.version }} + + - name: Build docker (budibase/apps) + uses: docker/build-push-action@v5 + with: + context: . + push: true + platforms: linux/amd64,linux/arm64 + build-args: | + BUDIBASE_VERSION=${{ env.BUDIBASE_VERSION }} + tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} + file: ./packages/server/Dockerfile.v2 + cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest + cache-to: type=inline + env: + IMAGE_NAME: budibase/apps + IMAGE_TAG: ${{ inputs.image_tag }} + BUDIBASE_VERSION: ${{ steps.currenttag.outputs.version }} release-helm-chart: needs: [release-images] From 0cc978f86050ffb40082013fb788fd07e81fb9b5 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:37:33 +0100 Subject: [PATCH 03/10] Push proxy dockerfile --- .github/workflows/release-master.yml | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index a8af6a4da1..4a89d8462f 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -74,7 +74,7 @@ jobs: DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} - - name: Build docker (budibase/worker) + - name: Build worker docker uses: docker/build-push-action@v5 with: context: . @@ -91,7 +91,7 @@ jobs: IMAGE_TAG: ${{ inputs.image_tag }} BUDIBASE_VERSION: ${{ steps.currenttag.outputs.version }} - - name: Build docker (budibase/apps) + - name: Build server docker uses: docker/build-push-action@v5 with: context: . @@ -108,6 +108,19 @@ jobs: IMAGE_TAG: ${{ inputs.image_tag }} BUDIBASE_VERSION: ${{ steps.currenttag.outputs.version }} + - name: Build proxy docker + uses: docker/build-push-action@v5 + with: + context: . + push: true + tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} + file: ./hosting/proxy/Dockerfile + cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest + cache-to: type=inline + env: + IMAGE_NAME: proxy-service + IMAGE_TAG: ${{ inputs.image_tag }} + release-helm-chart: needs: [release-images] runs-on: ubuntu-latest From a80ea2f2c05747fe4607e1bcafac5506b6d5b4f7 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:38:26 +0100 Subject: [PATCH 04/10] Clean scripts --- package.json | 2 -- packages/server/package.json | 1 - packages/worker/package.json | 1 - 3 files changed, 4 deletions(-) diff --git a/package.json b/package.json index 03257d2d06..417fb31e0e 100644 --- a/package.json +++ b/package.json @@ -54,8 +54,6 @@ "lint:fix:prettier": "prettier --write \"packages/**/*.{js,ts,svelte}\" && prettier --write \"examples/**/*.{js,ts,svelte}\" && prettier --write \"qa-core/**/*.{js,ts,svelte}\"", "lint:fix": "yarn run lint:fix:prettier && yarn run lint:fix:eslint", "build:specs": "lerna run --stream specs", - "build:docker": "lerna run --stream build:docker && yarn build:docker:proxy && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", - "build:docker:proxy": "docker build hosting/proxy -t proxy-service", "build:docker:airgap": "node hosting/scripts/airgapped/airgappedDockerBuild", "build:docker:airgap:single": "SINGLE_IMAGE=1 node hosting/scripts/airgapped/airgappedDockerBuild", "build:digitalocean": "cd hosting/digitalocean && ./build.sh && cd -", diff --git a/packages/server/package.json b/packages/server/package.json index c37959d33d..c845f7889d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -18,7 +18,6 @@ "test": "bash scripts/test.sh", "test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit", "test:watch": "jest --watch", - "build:docker": "yarn nx build && docker buildx build ../.. -t app-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION -f Dockerfile.v2 --platform linux/amd64,linux/arm64", "run:docker": "node dist/index.js", "run:docker:cluster": "pm2-runtime start pm2.config.js", "dev:stack:up": "node scripts/dev/manage.js up", diff --git a/packages/worker/package.json b/packages/worker/package.json index a391db533b..ec86575395 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -20,7 +20,6 @@ "run:docker": "node dist/index.js", "debug": "yarn build && node --expose-gc --inspect=9223 dist/index.js", "run:docker:cluster": "pm2-runtime start pm2.config.js", - "build:docker": "yarn nx build && docker buildx build ../.. -t worker-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION -f Dockerfile.v2 --platform linux/amd64,linux/arm64", "dev:stack:init": "node ./scripts/dev/manage.js init", "dev:builder": "npm run dev:stack:init && nodemon", "dev:built": "yarn run dev:stack:init && yarn run run:docker", From 0dd655e75dec40415c0e660af74dc2ee72c0802b Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:39:03 +0100 Subject: [PATCH 05/10] Remove sh --- .github/workflows/release-master.yml | 2 +- hosting/scripts/linux/release-to-docker-hub.sh | 18 ------------------ 2 files changed, 1 insertion(+), 19 deletions(-) delete mode 100755 hosting/scripts/linux/release-to-docker-hub.sh diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 4a89d8462f..24d71a35a6 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -118,7 +118,7 @@ jobs: cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest cache-to: type=inline env: - IMAGE_NAME: proxy-service + IMAGE_NAME: budibase/proxy-service IMAGE_TAG: ${{ inputs.image_tag }} release-helm-chart: diff --git a/hosting/scripts/linux/release-to-docker-hub.sh b/hosting/scripts/linux/release-to-docker-hub.sh deleted file mode 100755 index 599a10f914..0000000000 --- a/hosting/scripts/linux/release-to-docker-hub.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash - -tag=$1 - -if [[ ! "$tag" ]]; then - echo "No tag present. You must pass a tag to this script" - exit 1 -fi - -echo "Tagging images with tag: $tag" - -docker tag proxy-service budibase/proxy:$tag -docker tag app-service budibase/apps:$tag -docker tag worker-service budibase/worker:$tag - -docker push --all-tags budibase/apps -docker push --all-tags budibase/worker -docker push --all-tags budibase/proxy From 469114823600edb7f156fae9eef9514efed9b981 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:44:48 +0100 Subject: [PATCH 06/10] Cache yarn --- .github/workflows/release-master.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 24d71a35a6..c2bee8da40 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -36,6 +36,7 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 18.x + cache: yarn - run: yarn install --frozen-lockfile - name: Update versions From b74f11e0e2d23a67c6c6f30d404b2f719d4cbd32 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 14:53:14 +0100 Subject: [PATCH 07/10] Fix proxy image name --- .github/workflows/release-master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index c2bee8da40..5d67101f4e 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -119,7 +119,7 @@ jobs: cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest cache-to: type=inline env: - IMAGE_NAME: budibase/proxy-service + IMAGE_NAME: budibase/proxy IMAGE_TAG: ${{ inputs.image_tag }} release-helm-chart: From ac3c9a374cbefa12e51e7dc2354128cc344f5240 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 15:02:36 +0100 Subject: [PATCH 08/10] Fix image tag --- .github/workflows/release-master.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 5d67101f4e..e0adddc6a8 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -89,7 +89,7 @@ jobs: cache-to: type=inline env: IMAGE_NAME: budibase/worker - IMAGE_TAG: ${{ inputs.image_tag }} + IMAGE_TAG: ${{ steps.currenttag.outputs.version }} BUDIBASE_VERSION: ${{ steps.currenttag.outputs.version }} - name: Build server docker @@ -106,7 +106,7 @@ jobs: cache-to: type=inline env: IMAGE_NAME: budibase/apps - IMAGE_TAG: ${{ inputs.image_tag }} + IMAGE_TAG: ${{ steps.currenttag.outputs.version }} BUDIBASE_VERSION: ${{ steps.currenttag.outputs.version }} - name: Build proxy docker @@ -120,7 +120,7 @@ jobs: cache-to: type=inline env: IMAGE_NAME: budibase/proxy - IMAGE_TAG: ${{ inputs.image_tag }} + IMAGE_TAG: ${{ steps.currenttag.outputs.version }} release-helm-chart: needs: [release-images] From 344256a80588543427987e93b32c67d25766783e Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 15:57:40 +0100 Subject: [PATCH 09/10] Fix proxy build --- .github/workflows/release-master.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index e0adddc6a8..e1feaa1e7c 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -112,7 +112,7 @@ jobs: - name: Build proxy docker uses: docker/build-push-action@v5 with: - context: . + context: ./hosting/proxy push: true tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} file: ./hosting/proxy/Dockerfile From b3a4a921aa195aacf68c5dd8dfd84f27b45e1cf1 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 16:47:47 +0100 Subject: [PATCH 10/10] Build multi platform proxy --- .github/workflows/release-master.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index e1feaa1e7c..df25182cd6 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -114,6 +114,7 @@ jobs: with: context: ./hosting/proxy push: true + platforms: linux/amd64,linux/arm64 tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }} file: ./hosting/proxy/Dockerfile cache-from: type=registry,ref=${{ env.IMAGE_NAME }}:latest