From e266f84da72447eb5cf667fedb1b88ed3daa50d8 Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Wed, 8 Jan 2025 00:59:40 -0500 Subject: [PATCH] initial commit --- .github/workflows/build-arch-images.yml | 70 +++++++++++++++++++++++++ LICENSE | 21 ++++++++ docker/Dockerfile.arch | 17 ++++++ docker/Dockerfile.artix | 19 +++++++ docker/scripts/entrypoint.sh | 21 ++++++++ docker/scripts/testing.arch.sh | 13 +++++ docker/scripts/testing.artix.sh | 0 7 files changed, 161 insertions(+) create mode 100644 .github/workflows/build-arch-images.yml create mode 100644 LICENSE create mode 100644 docker/Dockerfile.arch create mode 100644 docker/Dockerfile.artix create mode 100755 docker/scripts/entrypoint.sh create mode 100755 docker/scripts/testing.arch.sh create mode 100755 docker/scripts/testing.artix.sh diff --git a/.github/workflows/build-arch-images.yml b/.github/workflows/build-arch-images.yml new file mode 100644 index 0000000..138eac7 --- /dev/null +++ b/.github/workflows/build-arch-images.yml @@ -0,0 +1,70 @@ +name: Docker Image CI + +on: + workflow_dispatch: + branches: [ master ] + push: + branches: [ master ] + paths: [ docker/* ] + pull_request: + branches: [ master ] + paths: [ docker/* ] + schedule: + - cron: '0 5 * * 4' + +jobs: + + build_arch_images: + name: Build build images + runs-on: ubuntu-latest + timeout-minutes: 20 + strategy: + fail-fast: true + matrix: + images: + [ + arch, + artix + ] + env: + DH_REGISTRY: docker.io + REPO_ORG: corysanin + IMAGE_NAME: archy-build-thing + ABSOLUTE_DH_IMAGE: ${{ env.DH_REGISTRY }}/${{ REPO_ORG }}/${{ env.IMAGE_NAME }} + permissions: + contents: read + packages: write + + steps: + # - name: Checkout repository + # uses: https://github.com/actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v2 + with: + install: true + + - name: Build Docker image + uses: https://github.com/docker/build-push-action@v5 + with: + push: false + pull: true + no-cache: true + context: ./docker/ + file: ./docker/Dockerfile.${{ matrix.images }} + tags: "${{ env.ABSOLUTE_DH_IMAGE }}:${{ matrix.images }}" + + - name: Log in to the Docker Hub + uses: https://github.com/docker/login-action@v3 + with: + registry: ${{ env.DH_REGISTRY }} + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Push to Docker Hub + if: github.ref == 'refs/heads/master' && ( gitea.event_name == 'push' || gitea.event_name == 'schedule' ) + run: docker push "${{ env.ABSOLUTE_DH_IMAGE }}:${{ matrix.images }}" diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8c8547e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Cory Sanin + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/docker/Dockerfile.arch b/docker/Dockerfile.arch new file mode 100644 index 0000000..4f48117 --- /dev/null +++ b/docker/Dockerfile.arch @@ -0,0 +1,17 @@ +FROM archlinux/archlinux:base-devel + +COPY scripts/entrypoint.sh /scripts/entrypoint.sh +COPY scripts/testing.arch.sh /scripts/testing.sh + +RUN sed -i '1iServer = https://mirror.sanin.dev/arch-linux/\$repo/os/\$arch' /etc/pacman.d/mirrorlist && \ + pacman -Syu --noconfirm git clang sudo devtools vim bash-completion && \ + chmod +x /scripts/* && \ + useradd -m user && \ + echo "user:pass-$RANDOM" | chpasswd && \ + echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers + +USER user + +WORKDIR /home/user/ + +CMD [ "/scripts/entrypoint.sh" ] diff --git a/docker/Dockerfile.artix b/docker/Dockerfile.artix new file mode 100644 index 0000000..b597e1d --- /dev/null +++ b/docker/Dockerfile.artix @@ -0,0 +1,19 @@ +FROM artixlinux/artixlinux:base-devel + +COPY scripts/entrypoint.sh /scripts/entrypoint.sh +COPY scripts/testing.artix.sh /scripts/testing.sh + +ARG MIRROR=https://mirror.sanin.dev/artix-linux/\$repo/os/\$arch + +RUN sed -i '1iServer = $MIRROR' /etc/pacman.d/mirrorlist && \ + pacman -Syu --noconfirm git clang sudo vim glibc openssh bash-completion && \ + chmod +x /scripts/* && \ + useradd -m user && \ + echo "user:pass-$RANDOM" | chpasswd && \ + echo 'user ALL=(ALL) NOPASSWD: ALL' >> /etc/sudoers + +USER user + +WORKDIR /home/user/ + +CMD [ "/bin/bash" ] diff --git a/docker/scripts/entrypoint.sh b/docker/scripts/entrypoint.sh new file mode 100755 index 0000000..9f1fdf0 --- /dev/null +++ b/docker/scripts/entrypoint.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ -n "$DEP" ] +then + if [ "$DEP" = "testing" ] + then + /scripts/testing.sh + fi +fi + +if [ -z "$REPO" ] +then + /bin/bash + exit $?; +fi + +# Clone the git repo +git clone "$REPO" /home/user/pkg +cd /home/user/pkg +makepkg -smf --noconfirm --noprogressbar --skippgpcheck --noarchive +exit $?; diff --git a/docker/scripts/testing.arch.sh b/docker/scripts/testing.arch.sh new file mode 100755 index 0000000..15f9b13 --- /dev/null +++ b/docker/scripts/testing.arch.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# Enable the [core-testing] repository by uncommenting the relevant lines in the configuration file +sudo sed -i 's/^#\[core-testing\]/\[core-testing\]/' /etc/pacman.conf + +# Enable the [extra-testing] repository by uncommenting the relevant lines in the configuration file +sudo sed -i 's/^#\[extra-testing\]/\[extra-testing\]/' /etc/pacman.conf + +# Uncomment the 'Include = /etc/pacman.d/mirrorlist' line in the configuration file if necessary +sudo sed -i '/testing\]/{n;s/^#//}' /etc/pacman.conf + +# Update the package list and upgrade the system +sudo pacman -Syu diff --git a/docker/scripts/testing.artix.sh b/docker/scripts/testing.artix.sh new file mode 100755 index 0000000..e69de29