Skip to content

Commit

Permalink
refactor(ci): Use docker/build-push-action to build docker images
Browse files Browse the repository at this point in the history
Replace the build-docker.sh script with a GitHub action to standardize
the ci workflow and reduce complexity.
  • Loading branch information
vitoyucepi committed Jan 8, 2025
1 parent 5042b4d commit 93f0d0f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 deletions.
11 changes: 4 additions & 7 deletions .github/scripts/build-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,13 @@ docker build \
--tag "savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}" \
.


docker tag \
"savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}" \
"ghcr.io/savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}"
docker push "ghcr.io/savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}"

if [ "${PUBLISH_DOCKER_IMAGE}" != "true" ]; then
exit 0
fi

docker tag \
"savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}" \
"ghcr.io/savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}"

docker push "savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}"
#docker push "ghcr.io/savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}"
docker push "ghcr.io/savonet/liquidsoap-ci-build:${TAG}_${ARCHITECTURE}"
18 changes: 13 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -645,16 +645,24 @@ jobs:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Login to GitHub Container Registry
# if: needs.build_details.outputs.publish_docker_image == 'true'
if: needs.build_details.outputs.publish_docker_image == 'true'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build docker image
env:
PUBLISH_DOCKER_IMAGE: ${{ needs.build_details.outputs.publish_docker_image }}
run: .github/scripts/build-docker.sh "${{ steps.debian_package.outputs.deb-file }}" "${{ steps.debian_debug_package.outputs.deb-file }}" "${{ needs.build_details.outputs.branch }}" "${{ matrix.platform }}"
- name: Build and push docker image
uses: docker/build-push-action@v6
with:
build-args: |
"DEB_FILE=${{ steps.debian_package.outputs.deb-file }}"
"DEB_DEBUG_FILE=${{ steps.debian_debug_package.outputs.deb-file }}"
context: .
file: .github/docker/debian.dockerfile
tags: |
"savonet/liquidsoap-ci-build:${{ needs.build_details.outputs.branch }}_${{ matrix.platform }}"
"ghcr.io/savonet/liquidsoap-ci-build:${{ needs.build_details.outputs.branch }}_${{ matrix.platform }}"
push: ${{ needs.build_details.outputs.publish_docker_image }}

build_docker_alpine:
runs-on: ${{ matrix.runs-on }}
Expand Down

0 comments on commit 93f0d0f

Please sign in to comment.