From 725e3aa4ef8431990fa9a54d9857f12f95da9a5d Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 10:11:06 +0100 Subject: [PATCH 1/7] Use image v2 on build:docker --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 4a858f3be9..b89fe86a84 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -18,7 +18,7 @@ "test": "bash scripts/test.sh", "test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit", "test:watch": "jest --watch", - "build:docker": "yarn build && docker build . -t app-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION", + "build:docker": "yarn nx build && docker build ../.. -t app-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION -f Dockerfile.v2", "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 205bf3309a..dd847e6df4 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -20,7 +20,7 @@ "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 build && docker build . -t worker-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION", + "build:docker": "yarn nx build && docker build ../.. -t worker-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION -f Dockerfile.v2", "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 b542040ad4fa3d379842348633fbe15546c816b0 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 10:27:59 +0100 Subject: [PATCH 2/7] Use v2 for single image --- .github/workflows/release-singleimage.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-singleimage.yml b/.github/workflows/release-singleimage.yml index f7f87f6e4c..4d35916f4d 100644 --- a/.github/workflows/release-singleimage.yml +++ b/.github/workflows/release-singleimage.yml @@ -67,7 +67,7 @@ jobs: push: true platforms: linux/amd64,linux/arm64 tags: budibase/budibase,budibase/budibase:${{ env.RELEASE_VERSION }} - file: ./hosting/single/Dockerfile + file: ./hosting/single/Dockerfile.v2 - name: Tag and release Budibase Azure App Service docker image uses: docker/build-push-action@v2 with: @@ -76,4 +76,4 @@ jobs: platforms: linux/amd64 build-args: TARGETBUILD=aas tags: budibase/budibase-aas,budibase/budibase-aas:${{ env.RELEASE_VERSION }} - file: ./hosting/single/Dockerfile + file: ./hosting/single/Dockerfile.v2 From b0ef79bbd9f9a7ab3a8bbe2f5513426ff2b61362 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 11:36:32 +0100 Subject: [PATCH 3/7] Build for both amd and arm platforms --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index b89fe86a84..c37959d33d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -18,7 +18,7 @@ "test": "bash scripts/test.sh", "test:memory": "jest --maxWorkers=2 --logHeapUsage --forceExit", "test:watch": "jest --watch", - "build:docker": "yarn nx build && docker build ../.. -t app-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION -f Dockerfile.v2", + "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 dd847e6df4..a391db533b 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -20,7 +20,7 @@ "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 build ../.. -t worker-service --label version=$BUDIBASE_RELEASE_VERSION --build-arg BUDIBASE_VERSION=$BUDIBASE_RELEASE_VERSION -f Dockerfile.v2", + "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 6267d9b601e7b350388b5adb139e6ef6c9cb2b16 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 11:39:25 +0100 Subject: [PATCH 4/7] Test building images --- .github/workflows/budibase_ci.yml | 33 +++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 77867c8617..3ec87f7244 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -42,6 +42,39 @@ jobs: - run: yarn --frozen-lockfile - run: yarn lint + test-release-images: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + submodules: true + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + fetch-depth: 0 + + - uses: actions/setup-node@v1 + with: + node-version: 18.x + + - run: yarn install --frozen-lockfile + - name: Update versions + run: ./scripts/updateVersions.sh + - run: yarn lint + - run: yarn build + - run: yarn build:sdk + + - name: "Get Current tag" + id: currenttag + run: | + version=$(./scripts/getCurrentVersion.sh) + echo "Using tag $version" + echo "version=$version" >> "$GITHUB_OUTPUT" + + - name: Build/release Docker images + run: | + yarn lerna run --stream build:docker + env: + BUDIBASE_RELEASE_VERSION: ${{ steps.currenttag.outputs.version }} + build: runs-on: ubuntu-latest steps: From ac67a17b9393979b65f8bf4335a4f83232872e97 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 11:45:05 +0100 Subject: [PATCH 5/7] Use buildx --- .github/workflows/budibase_ci.yml | 6 +++++- .github/workflows/release-master.yml | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 3ec87f7244..13245a7fa1 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -51,9 +51,10 @@ jobs: token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} fetch-depth: 0 - - uses: actions/setup-node@v1 + - uses: actions/setup-node@v3 with: node-version: 18.x + cache: "yarn" - run: yarn install --frozen-lockfile - name: Update versions @@ -69,6 +70,9 @@ jobs: echo "Using tag $version" echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Setup Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 - name: Build/release Docker images run: | yarn lerna run --stream build:docker diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-master.yml index 9ab8530341..4c5a3f4a1e 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-master.yml @@ -63,6 +63,9 @@ jobs: echo "Using tag $version" echo "version=$version" >> "$GITHUB_OUTPUT" + - name: Setup Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 - name: Build/release Docker images run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD From 24eed537edc45d8febb9c119f5a4f54f7f296558 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 12:00:55 +0100 Subject: [PATCH 6/7] Fix timeouts --- packages/server/Dockerfile | 2 +- packages/worker/Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/Dockerfile b/packages/server/Dockerfile index e1b3b208c7..ea4c5b217a 100644 --- a/packages/server/Dockerfile +++ b/packages/server/Dockerfile @@ -38,7 +38,7 @@ RUN apt update && apt upgrade -y \ COPY package.json . COPY dist/yarn.lock . -RUN yarn install --production=true \ +RUN yarn install --production=true --network-timeout 1000000 \ # Remove unneeded data from file system to reduce image size && yarn cache clean && apt-get remove -y --purge --auto-remove g++ make python \ && rm -rf /tmp/* /root/.node-gyp /usr/local/lib/node_modules/npm/node_modules/node-gyp diff --git a/packages/worker/Dockerfile b/packages/worker/Dockerfile index 4230ee86f8..50f1bb78b9 100644 --- a/packages/worker/Dockerfile +++ b/packages/worker/Dockerfile @@ -14,7 +14,7 @@ RUN yarn global add pm2 COPY package.json . COPY dist/yarn.lock . -RUN yarn install --production=true +RUN yarn install --production=true --network-timeout 1000000 # Remove unneeded data from file system to reduce image size RUN apk del .gyp \ && yarn cache clean From d9c34f3f465476291b2cad1b539e0e5e3ceb649e Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Mon, 30 Oct 2023 12:40:05 +0100 Subject: [PATCH 7/7] Remove build docker in ci pipelines --- .github/workflows/budibase_ci.yml | 37 ------------------------------- 1 file changed, 37 deletions(-) diff --git a/.github/workflows/budibase_ci.yml b/.github/workflows/budibase_ci.yml index 13245a7fa1..77867c8617 100644 --- a/.github/workflows/budibase_ci.yml +++ b/.github/workflows/budibase_ci.yml @@ -42,43 +42,6 @@ jobs: - run: yarn --frozen-lockfile - run: yarn lint - test-release-images: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - with: - submodules: true - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - fetch-depth: 0 - - - uses: actions/setup-node@v3 - with: - node-version: 18.x - cache: "yarn" - - - run: yarn install --frozen-lockfile - - name: Update versions - run: ./scripts/updateVersions.sh - - run: yarn lint - - run: yarn build - - run: yarn build:sdk - - - name: "Get Current tag" - id: currenttag - run: | - version=$(./scripts/getCurrentVersion.sh) - echo "Using tag $version" - echo "version=$version" >> "$GITHUB_OUTPUT" - - - name: Setup Docker Buildx - id: buildx - uses: docker/setup-buildx-action@v1 - - name: Build/release Docker images - run: | - yarn lerna run --stream build:docker - env: - BUDIBASE_RELEASE_VERSION: ${{ steps.currenttag.outputs.version }} - build: runs-on: ubuntu-latest steps: