From 4a3fcba8eb28ed8f07c127beeb8700d01f204628 Mon Sep 17 00:00:00 2001 From: Incede <33103370+Incede@users.noreply.github.com> Date: Mon, 6 Jan 2025 10:11:53 +0100 Subject: [PATCH] Create docker.yaml --- .github/workflows/docker.yaml | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/docker.yaml diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml new file mode 100644 index 00000000..f655b231 --- /dev/null +++ b/.github/workflows/docker.yaml @@ -0,0 +1,46 @@ +name: Build docker image + +on: + push: + branches: + - master + +jobs: + docker: + name: Build and push docker image + permissions: + id-token: write + contents: read + runs-on: ubuntu-latest + environment: ${{ github.ref_name }} + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: eu-west-3 + + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a + + - name: Docker image + id: docker-image + run: | + echo "image=${{ steps.login-ecr.outputs.registry }}/${{ secrets.ECR_REPOSITORY }}" >> $GITHUB_OUTPUT + + - name: Build and push the image + uses: docker/build-push-action@v6 + id: docker-build + with: + context: ./ + file: ./Dockerfile + push: true + tags: | + ${{ steps.docker-image.outputs.image }}:latest + ${{ steps.docker-image.outputs.image }}:${{ github.sha }}