name: Docker Image CI permissions: packages: write contents: read id-token: write on: # yamllint disable-line rule:truthy pull_request_target: types: - closed branches: - 'main' jobs: push_to_registry: name: Push Docker image to ECR Public if: github.event.pull_request.merged == true env: REGISTRY: 808326389482.dkr.ecr.us-east-1.amazonaws.com IMAGE_TAG: latest REGION: us-east-1 runs-on: ubuntu-latest steps: - name: Check out the repo uses: actions/checkout@v4 ################################################## ################## ECR PUBLIC #################### ################################################## - name: Configure AWS credentials uses: aws-actions/configure-aws-credentials@master # More information on this action can be found below in the 'AWS Credentials' section with: role-to-assume: arn:aws:iam::808326389482:role/automation aws-region: us-east-1 - name: Login to Amazon ECR Public id: login-ecr-public uses: aws-actions/amazon-ecr-login@v2 with: registry-type: public ############################### ###### Docker Image: ####### ###### RUBY ####### ############################### - name: Build, tag, and push docker image to Amazon ECR Public - Ruby if: contains(github.event.pull_request.labels.*.name, 'Ruby') env: REPOSITORY: ruby run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ###### Docker Image: ####### ###### PYTHON ####### ################################# - name: Build, tag, and push docker image to Amazon ECR Public - Python if: contains(github.event.pull_request.labels.*.name, 'Python') env: REPOSITORY: python run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### JAVASCRIPT v3 ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - JavaScript if: contains(github.event.pull_request.labels.*.name, 'Javascript-v3') env: REPOSITORY: javascriptv3 run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile . docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### RUST ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - Rust if: contains(github.event.pull_request.labels.*.name, 'Rust') env: REPOSITORY: rustv1 run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### GO v2 ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - GoLang if: contains(github.event.pull_request.labels.*.name, 'Go-v2') env: REPOSITORY: gov2 run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### C++ ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - C++ if: contains(github.event.pull_request.labels.*.name, 'C++') env: REPOSITORY: cpp run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### .NET v3 ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - .NET v3 if: contains(github.event.pull_request.labels.*.name, 'DotNet-v3') env: REPOSITORY: dotnetv3 run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### JAVA v2 ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - JavaV2 if: contains(github.event.pull_request.labels.*.name, 'Java-v2') env: REPOSITORY: javav2 run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### KOTLIN ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - Kotlin if: contains(github.event.pull_request.labels.*.name, 'Kotlin') env: REPOSITORY: kotlin run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### PHP ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - PHP if: contains(github.event.pull_request.labels.*.name, 'PHP') env: REPOSITORY: php run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true ################################# ####### Docker Image: ######## ####### SWIFT ######## ################################# - name: Build, tag, and push docker image to Amazon ECR Public - Swift if: contains(github.event.pull_request.labels.*.name, 'Swift') env: REPOSITORY: swift run: | aws ecr get-login-password --region $REGION | docker login --username AWS --password-stdin $REGISTRY docker build -t $REPOSITORY -f ./$REPOSITORY/Dockerfile ./$REPOSITORY docker tag $REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:$IMAGE_TAG docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG continue-on-error: true