diff --git a/.github/workflows/pr-integration-tests.yml b/.github/workflows/pr-integration-tests.yml index 5690cb87c2..7da11bf34b 100644 --- a/.github/workflows/pr-integration-tests.yml +++ b/.github/workflows/pr-integration-tests.yml @@ -72,9 +72,14 @@ jobs: all_dirs="[${all_dirs%,}]" echo "test-dirs=$all_dirs" >> $GITHUB_OUTPUT - build-backend-image: - runs-on: [runs-on, runner=1cpu-linux-arm64, "run-id=${{ github.run_id }}-build-backend-image", "extras=ecr-cache"] + runs-on: + [ + runs-on, + runner=1cpu-linux-arm64, + "run-id=${{ github.run_id }}-build-backend-image", + "extras=ecr-cache", + ] timeout-minutes: 45 steps: - uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2 @@ -127,9 +132,14 @@ jobs: type=registry,ref=${{ env.RUNS_ON_ECR_CACHE }}:backend-cache,mode=max no-cache: ${{ vars.DOCKER_NO_CACHE == 'true' }} - build-model-server-image: - runs-on: [runs-on, runner=1cpu-linux-arm64, "run-id=${{ github.run_id }}-build-model-server-image", "extras=ecr-cache"] + runs-on: + [ + runs-on, + runner=1cpu-linux-arm64, + "run-id=${{ github.run_id }}-build-model-server-image", + "extras=ecr-cache", + ] timeout-minutes: 45 steps: - uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2 @@ -181,9 +191,14 @@ jobs: type=registry,ref=${{ env.RUNS_ON_ECR_CACHE }}:model-server-cache-${{ steps.format-branch.outputs.cache-suffix }},mode=max type=registry,ref=${{ env.RUNS_ON_ECR_CACHE }}:model-server-cache,mode=max - build-integration-image: - runs-on: [runs-on, runner=2cpu-linux-arm64, "run-id=${{ github.run_id }}-build-integration-image", "extras=ecr-cache"] + runs-on: + [ + runs-on, + runner=2cpu-linux-arm64, + "run-id=${{ github.run_id }}-build-integration-image", + "extras=ecr-cache", + ] timeout-minutes: 45 steps: - uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2 @@ -225,7 +240,7 @@ jobs: CACHE_SUFFIX: ${{ steps.format-branch.outputs.cache-suffix }} HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} run: | - cd backend && docker buildx bake --push \ + docker buildx bake --push \ --set backend.cache-from=type=registry,ref=${RUNS_ON_ECR_CACHE}:backend-cache-${HEAD_SHA} \ --set backend.cache-from=type=registry,ref=${RUNS_ON_ECR_CACHE}:backend-cache-${CACHE_SUFFIX} \ --set backend.cache-from=type=registry,ref=${RUNS_ON_ECR_CACHE}:backend-cache \ @@ -437,15 +452,16 @@ jobs: path: ${{ github.workspace }}/docker-compose.log # ------------------------------------------------------------ - multitenant-tests: needs: + [build-backend-image, build-model-server-image, build-integration-image] + runs-on: [ - build-backend-image, - build-model-server-image, - build-integration-image, + runs-on, + runner=8cpu-linux-arm64, + "run-id=${{ github.run_id }}-multitenant-tests", + "extras=ecr-cache", ] - runs-on: [runs-on, runner=8cpu-linux-arm64, "run-id=${{ github.run_id }}-multitenant-tests", "extras=ecr-cache"] timeout-minutes: 45 steps: diff --git a/.github/workflows/pr-mit-integration-tests.yml b/.github/workflows/pr-mit-integration-tests.yml index 70df2e2909..286756c6b2 100644 --- a/.github/workflows/pr-mit-integration-tests.yml +++ b/.github/workflows/pr-mit-integration-tests.yml @@ -65,7 +65,13 @@ jobs: echo "test-dirs=$all_dirs" >> $GITHUB_OUTPUT build-backend-image: - runs-on: [runs-on, runner=1cpu-linux-arm64, "run-id=${{ github.run_id }}-build-backend-image", "extras=ecr-cache"] + runs-on: + [ + runs-on, + runner=1cpu-linux-arm64, + "run-id=${{ github.run_id }}-build-backend-image", + "extras=ecr-cache", + ] timeout-minutes: 45 steps: - uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2 @@ -119,7 +125,13 @@ jobs: no-cache: ${{ vars.DOCKER_NO_CACHE == 'true' }} build-model-server-image: - runs-on: [runs-on, runner=1cpu-linux-arm64, "run-id=${{ github.run_id }}-build-model-server-image", "extras=ecr-cache"] + runs-on: + [ + runs-on, + runner=1cpu-linux-arm64, + "run-id=${{ github.run_id }}-build-model-server-image", + "extras=ecr-cache", + ] timeout-minutes: 45 steps: - uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2 @@ -172,7 +184,13 @@ jobs: type=registry,ref=${{ env.RUNS_ON_ECR_CACHE }}:model-server-cache,mode=max build-integration-image: - runs-on: [runs-on, runner=2cpu-linux-arm64, "run-id=${{ github.run_id }}-build-integration-image", "extras=ecr-cache"] + runs-on: + [ + runs-on, + runner=2cpu-linux-arm64, + "run-id=${{ github.run_id }}-build-integration-image", + "extras=ecr-cache", + ] timeout-minutes: 45 steps: - uses: runs-on/action@cd2b598b0515d39d78c38a02d529db87d2196d1e # ratchet:runs-on/action@v2 @@ -214,7 +232,7 @@ jobs: CACHE_SUFFIX: ${{ steps.format-branch.outputs.cache-suffix }} HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }} run: | - cd backend && docker buildx bake --push \ + docker buildx bake --push \ --set backend.cache-from=type=registry,ref=${RUNS_ON_ECR_CACHE}:backend-cache-${HEAD_SHA} \ --set backend.cache-from=type=registry,ref=${RUNS_ON_ECR_CACHE}:backend-cache-${CACHE_SUFFIX} \ --set backend.cache-from=type=registry,ref=${RUNS_ON_ECR_CACHE}:backend-cache \ @@ -420,7 +438,6 @@ jobs: path: ${{ github.workspace }}/docker-compose.log # ------------------------------------------------------------ - required: # NOTE: Github-hosted runners have about 20s faster queue times and are preferred here. runs-on: ubuntu-slim diff --git a/backend/docker-bake.hcl b/docker-bake.hcl similarity index 69% rename from backend/docker-bake.hcl rename to docker-bake.hcl index 2fe38b7fa9..b86563199d 100644 --- a/backend/docker-bake.hcl +++ b/docker-bake.hcl @@ -1,11 +1,15 @@ group "default" { - targets = ["backend", "model-server"] + targets = ["backend", "model-server", "web"] } variable "BACKEND_REPOSITORY" { default = "onyxdotapp/onyx-backend" } +variable "WEB_SERVER_REPOSITORY" { + default = "onyxdotapp/onyx-web-server" +} + variable "MODEL_SERVER_REPOSITORY" { default = "onyxdotapp/onyx-model-server" } @@ -19,7 +23,7 @@ variable "TAG" { } target "backend" { - context = "." + context = "backend" dockerfile = "Dockerfile" cache-from = ["type=registry,ref=${BACKEND_REPOSITORY}:latest"] @@ -28,8 +32,18 @@ target "backend" { tags = ["${BACKEND_REPOSITORY}:${TAG}"] } +target "web" { + context = "web" + dockerfile = "Dockerfile" + + cache-from = ["type=registry,ref=${WEB_SERVER_REPOSITORY}:latest"] + cache-to = ["type=inline"] + + tags = ["${WEB_SERVER_REPOSITORY}:${TAG}"] +} + target "model-server" { - context = "." + context = "backend" dockerfile = "Dockerfile.model_server" @@ -40,7 +54,7 @@ target "model-server" { } target "integration" { - context = "." + context = "backend" dockerfile = "tests/integration/Dockerfile" // Provide the base image via build context from the backend target