Skip to content

Commit

Permalink
chore: refactor image building
Browse files Browse the repository at this point in the history
In the push.yml file, the docker images build process has been updated. The changes include the use of QEMU and Docker Buildx. Docker images for various environments like scratch, Debian version, Alma version, etc., are now built and pushed using Docker's build-push-action.

Signed-off-by: Abdelkader Boudih <terminale@gmail.com>
  • Loading branch information
seuros authored and ostafen committed Apr 11, 2024
1 parent a1f23d3 commit 5993978
Showing 1 changed file with 73 additions and 10 deletions.
83 changes: 73 additions & 10 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -232,23 +232,86 @@ jobs:
ALMA_VERSION: almalinux-8-minimal
steps:
- uses: actions/checkout@v4
- name: Build docker images
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and push Docker image for Dockerfile
uses: docker/build-push-action@v5
with:
context: .
target: scratch
tags: |
${{ env.DOCKER_IMAGE_IMMUDB }}:dev
file: build/Dockerfile

- name: Build and push Docker image for Dockerfile ${{ env.DEBIAN_VERSION }}
uses: docker/build-push-action@v5
with:
context: .
target: ${{ env.DEBIAN_VERSION }}
tags: |
${{ env.DOCKER_IMAGE_IMMUDB }}:dev-${ env.DEBIAN_VERSION }
file: build/Dockerfile

- name: Build and push Docker image for Dockerfile ${{ env.ALMA_VERSION }}
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_IMMUDB }}:dev-${ env.ALMA_VERSION }
file: build/Dockerfile.alma

- name: Build and push Docker image for Dockerfile.immuadmin
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_IMMUADMIN }}:dev
file: build/Dockerfile.immuadmin

- name: Build and push Docker image for Dockerfile.immuclient
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_IMMUCLIENT }}:dev
file: build/Dockerfile.immuclient

- name: Build and push Docker image for fips/Dockerfile
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_IMMUDB_FIPS }}:dev
file: build/fips/Dockerfile

- name: Build and push Docker image for fips/Dockerfile.immuadmin
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_IMMUADMIN_FIPS }}:dev
file: build/fips/Dockerfile.immuadmin

- name: Build and push Docker image for fips/Dockerfile.immuclient
uses: docker/build-push-action@v5
with:
context: .
tags: |
${{ env.DOCKER_IMAGE_IMMUCLIENT_FIPS }}:dev
file: build/fips/Dockerfile.immuclient

- name: Push docker images
shell: bash
run: |
if [[ "${GITHUB_REF}" =~ ^refs/tags/v([0-9]+)\.([A-Z0-9]+)\.([0-9]+)$ ]]; then
VERSION_TAG="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
VERSION_TAG_SHORT="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}"
fi
docker build --tag "${DOCKER_IMAGE_IMMUDB}:dev" --target scratch -f build/Dockerfile .
docker build --tag "${DOCKER_IMAGE_IMMUDB}:dev-${DEBIAN_VERSION}" --target ${DEBIAN_VERSION} -f build/Dockerfile .
docker build --tag "${DOCKER_IMAGE_IMMUDB}:dev-${ALMA_VERSION}" -f build/Dockerfile.alma .
docker build --tag "${DOCKER_IMAGE_IMMUADMIN}:dev" -f build/Dockerfile.immuadmin .
docker build --tag "${DOCKER_IMAGE_IMMUCLIENT}:dev" -f build/Dockerfile.immuclient .
docker build --tag "${DOCKER_IMAGE_IMMUDB_FIPS}:dev" -f build/fips/Dockerfile .
docker build --tag "${DOCKER_IMAGE_IMMUADMIN_FIPS}:dev" -f build/fips/Dockerfile.immuadmin .
docker build --tag "${DOCKER_IMAGE_IMMUCLIENT_FIPS}:dev" -f build/fips/Dockerfile.immuclient .
docker login -u "${{ secrets.REGISTRY_USER }}" -p "${{ secrets.REGISTRY_PASS }}"
docker push "${DOCKER_IMAGE_IMMUDB}:dev"
Expand Down

0 comments on commit 5993978

Please sign in to comment.