remove commitId=tip #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Push Image | |
on: push | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
ci: | |
name: Build Image and Push | |
runs-on: ubuntu-latest | |
steps: | |
# https://github.com/docker/login-action#quayio | |
- name: Login to Quay.io | |
uses: docker/login-action@v3 | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_ROBOT_TOKEN }} | |
# https://github.com/docker/login-action#aws-public-elastic-container-registry-ecr | |
- name: Login to ECR | |
uses: docker/login-action@v3 | |
with: | |
registry: 707767160287.dkr.ecr.us-east-1.amazonaws.com | |
username: ${{ secrets.ECR_AWS_ACCESS_KEY_ID }} | |
password: ${{ secrets.ECR_AWS_SECRET_ACCESS_KEY }} | |
env: | |
AWS_REGION: us-east-1 | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
fetch-depth: 0 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Set Variables | |
shell: bash | |
run: | | |
echo "IMAGE_TAG=orthancteam-$(echo ${GITHUB_REF#refs/*/} | tr / _)" | |
echo "IMAGE_TAG=orthancteam-$(echo ${GITHUB_REF#refs/*/} | tr / _)" >> $GITHUB_ENV | |
- name: Extract metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
quay.io/cdis/${{ env.REPO_NAME }}:${{ env.IMAGE_TAG }} | |
# ${{ inputs.AWS_ECR_REGISTRY }}/gen3/${{ env.REPO_NAME }}:${{ env.IMAGE_TAG }} | |
# - name: Build and push | |
# if: ${{ !inputs.USE_QUAY_ONLY }} | |
# uses: docker/build-push-action@v6 | |
# # You may get ECR-push errors when first adding the workflow to a github repo. | |
# # If so, run the following in dev/qa to create the ECR repository: | |
# # qaplanetv1@cdistest_dev_admin:~$ aws ecr create-repository --repository-name "gen3/<repo name>" --image-scanning-configuration scanOnPush=true | |
# with: | |
# context: ${{ inputs.DOCKERFILE_BUILD_CONTEXT }} | |
# file: ${{ inputs.DOCKERFILE_LOCATION }} | |
# push: true | |
# tags: | | |
# ${{ inputs.AWS_ECR_REGISTRY }}/gen3/${{ env.REPO_NAME }}:${{ env.IMAGE_TAG }} | |
# quay.io/cdis/${{ env.REPO_NAME }}:${{ env.IMAGE_TAG }} | |
# labels: ${{ steps.meta.outputs.labels }} | |
# cache-from: type=registry,ref=${{ inputs.AWS_ECR_REGISTRY }}/gen3/${{ env.REPO_NAME }}:cache | |
# cache-to: type=registry,ref=${{ inputs.AWS_ECR_REGISTRY }}/gen3/${{ env.REPO_NAME }}:cache,mode=max,image-manifest=true,oci-mediatypes=true | |
# platforms: ${{ inputs.BUILD_PLATFORMS }} | |
# - name: Build and push (Quay only) | |
# if: ${{ inputs.USE_QUAY_ONLY }} | |
# uses: docker/build-push-action@v6 | |
# with: | |
# context: ${{ inputs.DOCKERFILE_BUILD_CONTEXT }} | |
# file: ${{ inputs.DOCKERFILE_LOCATION }} | |
# push: true | |
# tags: | | |
# quay.io/cdis/${{ env.REPO_NAME }}:${{ env.IMAGE_TAG }} | |
# labels: ${{ steps.meta.outputs.labels }} | |
# platforms: ${{ inputs.BUILD_PLATFORMS }} | |
# TODO linux/arm64 image | |
- name: Build linux/amd64 image | |
# TODO add image name | |
run: ./local-build.sh version=stable platform=linux/amd64 image=normal type=ci step=build currentTag=${{ env.IMAGE_TAG }} | |
- name: Push linux/amd64 image | |
run: ./local-build.sh version=stable platform=linux/amd64 image=normal type=ci step=push currentTag=${{ env.IMAGE_TAG }} pushTag=${{ env.IMAGE_TAG }} isTag=true |