|
| 1 | +# Licensed to the Apache Software Foundation (ASF) under one |
| 2 | +# or more contributor license agreements. See the NOTICE file |
| 3 | +# distributed with this work for additional information |
| 4 | +# regarding copyright ownership. The ASF licenses this file |
| 5 | +# to you under the Apache License, Version 2.0 (the |
| 6 | +# "License"); you may not use this file except in compliance |
| 7 | +# with the License. You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, |
| 12 | +# software distributed under the License is distributed on an |
| 13 | +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 14 | +# KIND, either express or implied. See the License for the |
| 15 | +# specific language governing permissions and limitations |
| 16 | +# under the License. |
| 17 | + |
| 18 | +name: Docker Image Build |
| 19 | + |
| 20 | +on: |
| 21 | + push: |
| 22 | + branches: |
| 23 | + - main |
| 24 | + tags: |
| 25 | + - '*' |
| 26 | + pull_request: |
| 27 | + |
| 28 | +permissions: |
| 29 | + contents: read |
| 30 | + |
| 31 | +concurrency: |
| 32 | + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} |
| 33 | + cancel-in-progress: true |
| 34 | + |
| 35 | +jobs: |
| 36 | + build: |
| 37 | + if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository) |
| 38 | + runs-on: ubuntu-24.04 |
| 39 | + steps: |
| 40 | + - name: Login to Docker Registry |
| 41 | + uses: docker/login-action@v3 |
| 42 | + with: |
| 43 | + registry: ${{ secrets.DOCKER_REGISTRY }} |
| 44 | + username: ${{ secrets.DOCKERHUB_USER }} |
| 45 | + password: ${{ secrets.DOCKERHUB_TOKEN }} |
| 46 | + |
| 47 | + - name: Set Docker repository name |
| 48 | + run: echo "DOCKER_REPOSITORY=weizhouapache" >> $GITHUB_ENV |
| 49 | + |
| 50 | + - uses: actions/checkout@v4 |
| 51 | + with: |
| 52 | + fetch-depth: 0 |
| 53 | + |
| 54 | + - name: Set Docker image TAG |
| 55 | + run: echo "TAG=$(if [ "${{ github.event_name }}" = "pull_request" ];then echo "pr${{ github.event.pull_request.number}}"; elif [ "${{ github.ref_name }}" = "main" ];then echo "latest"; else echo ${{ github.ref_name }};fi)" >> $GITHUB_ENV |
| 56 | + |
| 57 | + - name: Set Docker image FULL TAG |
| 58 | + run: echo "FULL_TAG=$(if [ "${{ secrets.DOCKER_REGISTRY }}" = "" ];then echo ${DOCKER_REPOSITORY}/docker-systemd:${TAG};else echo ${{ secrets.DOCKER_REGISTRY }}/${DOCKER_REPOSITORY}/docker-systemd:${TAG};fi)" >> $GITHUB_ENV |
| 59 | + |
| 60 | + - name: Build the Docker image for docker-systemd |
| 61 | + run: docker build . --file Dockerfile.ubuntu24 --tag ${FULL_TAG}-ubuntu24 |
| 62 | + - name: Push Docker image to Docker Registry |
| 63 | + run: docker push ${FULL_TAG}-ubuntu24 |
| 64 | + |
| 65 | + - name: Build the Docker image for docker-systemd |
| 66 | + run: docker build . --file Dockerfile.debian12 --tag ${FULL_TAG}-debian12 |
| 67 | + - name: Push Docker image to Docker Registry |
| 68 | + run: docker push ${FULL_TAG}-debian12 |
| 69 | + |
| 70 | + - name: Build the Docker image for docker-systemd |
| 71 | + run: docker build . --file Dockerfile.alma9 --tag ${FULL_TAG}-alma9 |
| 72 | + - name: Push Docker image to Docker Registry |
| 73 | + run: docker push ${FULL_TAG}-alma9 |
| 74 | + |
| 75 | + - name: Build the Docker image for docker-systemd |
| 76 | + run: docker build . --file Dockerfile.oracle9 --tag ${FULL_TAG}-oracle9 |
| 77 | + - name: Push Docker image to Docker Registry |
| 78 | + run: docker push ${FULL_TAG}-oracle9 |
| 79 | + |
| 80 | + - name: Build the Docker image for docker-systemd |
| 81 | + run: docker build . --file Dockerfile.rocky9 --tag ${FULL_TAG}-rocky9 |
| 82 | + - name: Push Docker image to Docker Registry |
| 83 | + run: docker push ${FULL_TAG}-rocky9 |
| 84 | + |
0 commit comments