🐬 Builds ArchLinux Images for DockerHub 🐬 #127
This file contains hidden or 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: 🐬 Builds ArchLinux Images for DockerHub 🐬 | |
| #REF: https://docs.docker.com/build/ci/github-actions/multi-platform/ | |
| #SECRETS: DOCKERHUB_USERNAME || DOCKERHUB_TOKEN | |
| #URL: https://hub.docker.com/r/pkgforge/archlinux/tags | |
| #For: https://github.com/pkgforge/devscripts/tree/main/Github/Runners | |
| #------------------------------------------------------------------------------------# | |
| on: | |
| #push: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "30 08 * * *" # 08:30 PM UTC everyday | |
| defaults: | |
| run: | |
| shell: bash | |
| working-directory: /tmp | |
| permissions: | |
| contents: read | |
| packages: write | |
| #------------------------------------------------------------------------------------# | |
| jobs: | |
| build-push-docker-alpine: | |
| name: Push (ArchLinux) --> Docker Hub | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Debloat Runner | |
| run: | | |
| #Presets | |
| set +x ; set +e | |
| #--------------# | |
| bash <(curl -qfsSL "https://raw.githubusercontent.com/pkgforge/devscripts/refs/heads/main/Github/Runners/debloat_ubuntu.sh") | |
| continue-on-error: true | |
| - name: Setup Env | |
| run: | | |
| #Presets | |
| set +x ; set +e | |
| #--------------# | |
| #Docker Tags | |
| DOCKER_TAG="v$(date +'%Y.%m.%d')" && export DOCKER_TAG="$DOCKER_TAG" | |
| echo "DOCKER_TAG=$DOCKER_TAG" >> "${GITHUB_ENV}" | |
| #GHCR Tags | |
| echo "GHCR_NAME=ghcr.io/${{ github.repository_owner }}/archlinux" >> "${GITHUB_ENV}" | |
| #Repo | |
| mkdir -p "/tmp/ARCHLINUX" && pushd "/tmp/ARCHLINUX" >/dev/null 2>&1 | |
| git clone --filter="blob:none" --depth="1" "https://github.com/pkgforge-dev/docker-archlinux" | |
| popd >/dev/null 2>&1 | |
| continue-on-error: true | |
| - name: Update Mirrors | |
| run: | | |
| #Presets | |
| set +x ; set +e | |
| #--------------# | |
| pushd "$(mktemp -d)" >/dev/null 2>&1 | |
| wget "https://bin.pkgforge.dev/$(uname -m)/rate-mirrors" -O "./rate-mirrors" && chmod +x "./rate-mirrors" | |
| if [[ -s "./rate-mirrors" && $(stat -c%s "./rate-mirrors") -gt 10 ]]; then | |
| ##386 | |
| pushd "$(mktemp -d)" >/dev/null 2>&1 | |
| curl -qfsSL "https://archlinux32.org/mirrorlist/?country=all&protocol=https" -o "./mirrors.txt" | |
| sed -i '/^#Server/s/^#//' "./mirrors.txt" | |
| if [[ -s "./mirrors.txt" && $(wc -l < "./mirrors.txt") -gt 3 ]]; then | |
| cat "./mirrors.txt" | tee "/tmp/ARCHLINUX/docker-archlinux/rootfs/386/etc/pacman.d/mirrorlist" | |
| fi | |
| popd >/dev/null 2>&1 | |
| ##Arm64/Armv7 | |
| pushd "$(mktemp -d)" >/dev/null 2>&1 | |
| wget "https://bin.pkgforge.dev/$(uname -m)/rate-mirrors" -O "./rate-mirrors" && chmod +x "./rate-mirrors" | |
| "./rate-mirrors" --allow-root --disable-comments-in-file --save "./mirrors.txt" archarm | |
| if [[ -s "./mirrors.txt" && $(wc -l < "./mirrors.txt") -gt 3 ]]; then | |
| cat "./mirrors.txt" | tee "/tmp/ARCHLINUX/docker-archlinux/rootfs/arm64/etc/pacman.d/mirrorlist" | |
| cat "./mirrors.txt" | tee "/tmp/ARCHLINUX/docker-archlinux/rootfs/armv7/etc/pacman.d/mirrorlist" | |
| fi | |
| popd >/dev/null 2>&1 | |
| fi | |
| popd >/dev/null 2>&1 | |
| continue-on-error: true | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| continue-on-error: true | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| continue-on-error: true | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: "${{ secrets.DOCKERHUB_USERNAME }}" | |
| password: "${{ secrets.DOCKERHUB_TOKEN }}" | |
| continue-on-error: true | |
| - name: Login to GHCR | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: "${{ github.actor }}" | |
| password: "${{ secrets.GITHUB_TOKEN }}" | |
| #https://hub.docker.com/r/pkgforge/archlinux | |
| - name: Docker Build and Push (archlinux) | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: "/tmp/ARCHLINUX/docker-archlinux" | |
| platforms: "linux/386,linux/amd64,linux/arm64,linux/arm/v7,linux/riscv64,linux/ppc64le" | |
| tags: | | |
| pkgforge/archlinux:latest | |
| pkgforge/archlinux:${{ env.DOCKER_TAG }} | |
| ${{ env.GHCR_NAME }}:latest | |
| ${{ env.GHCR_NAME }}:${{ env.DOCKER_TAG }} | |
| push: true | |
| continue-on-error: true |