diff --git a/.github/workflows/docker-ci.yml b/.github/workflows/docker-ci.yml new file mode 100644 index 0000000000..8e39fa6cf6 --- /dev/null +++ b/.github/workflows/docker-ci.yml @@ -0,0 +1,34 @@ +name: Backend CI + +on: + push: + branches: + - "main" + + workflow_dispatch: + inputs: + debug_enabled: + type: boolean + description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" + required: false + default: false + +env: + CARGO_TERM_COLOR: always + RUST_LOG: info + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.AWS_REGION }} + +jobs: + build_and_push_docker_images: + name: Build and push docker images + runs-on: ubuntu-latest-8-cores + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Build and push api image + run: ./build-and-push-docker-images.sh api + - name: Build and push indexer image + run: ./build-and-push-docker-images.sh github-indexer + diff --git a/build-and-push-docker-images.sh b/build-and-push-docker-images.sh new file mode 100755 index 0000000000..3f68db30fa --- /dev/null +++ b/build-and-push-docker-images.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set +x; + +aws ecr get-login-password --region eu-west-3 | docker login --username AWS --password-stdin 113659546096.dkr.ecr.eu-west-3.amazonaws.com +docker build -t marketplace-backend-$1 . --build-arg BIN_NAME=$1 +docker tag marketplace-backend-$1:latest 113659546096.dkr.ecr.eu-west-3.amazonaws.com/marketplace-backend-$1:latest +docker push 113659546096.dkr.ecr.eu-west-3.amazonaws.com/marketplace-backend-$1:latest \ No newline at end of file