From 31fb5991ff0bf483dc4ff4a14175471326e122f2 Mon Sep 17 00:00:00 2001 From: Anders Rytter Hansen Date: Sun, 5 Nov 2023 15:02:16 +0100 Subject: [PATCH] add cachyos containers --- .github/workflows/cachyos.yml | 133 +++++++++++++++++++++ .github/workflows/tradingview.yml | 133 +++++++++++++++++++++ containers/cachyos/base-gui.Dockerfile | 41 +++++++ containers/cachyos/build.sh | 4 + containers/cachyos/etc/pacman.conf__custom | 115 ++++++++++++++++++ containers/cachyos/tradingview/Dockerfile | 10 ++ containers/cachyos/tradingview/build.sh | 8 ++ 7 files changed, 444 insertions(+) create mode 100644 .github/workflows/cachyos.yml create mode 100644 .github/workflows/tradingview.yml create mode 100644 containers/cachyos/base-gui.Dockerfile create mode 100755 containers/cachyos/build.sh create mode 100644 containers/cachyos/etc/pacman.conf__custom create mode 100644 containers/cachyos/tradingview/Dockerfile create mode 100755 containers/cachyos/tradingview/build.sh diff --git a/.github/workflows/cachyos.yml b/.github/workflows/cachyos.yml new file mode 100644 index 0000000..4c8236d --- /dev/null +++ b/.github/workflows/cachyos.yml @@ -0,0 +1,133 @@ +name: cachyos + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '0 6 * * 5' # 5 am on Saturdays + push: + paths: + - 'containers/cachyos/base-gui.Dockerfile' + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository_owner }}/containers/cachyos/base-gui + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Maximize build space + uses: AdityaGarg8/remove-unwanted-software@v1 + with: + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d')" + + - name: Test with environment variables + run: echo $DATE + env: + DATE: ${{ steps.date.outputs.date }} + + - name: Checkout repository + uses: actions/checkout@v3 + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 + with: + cosign-release: 'v2.1.1' + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + + # Build image using Buildah action + - name: Build Image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + containerfiles: | + ./containers/cachyos/base-gui.Dockerfile + image: ${{ env.IMAGE_NAME }} + tags: ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}.${{ steps.date.outputs.date }} + oci: false + layers: false + + # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. + # https://github.com/macbre/push-to-ghcr/issues/12 + - name: Lowercase Registry + id: registry_case + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ env.IMAGE_REGISTRY }} + + # Push the image to GHCR (Image Registry) + - name: Push To GHCR + uses: redhat-actions/push-to-registry@v2 + id: push + if: github.event_name != 'pull_request' + env: + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ github.token }} + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ steps.registry_case.outputs.lowercase }} + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + extra-args: | + --disable-content-trust + + + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} diff --git a/.github/workflows/tradingview.yml b/.github/workflows/tradingview.yml new file mode 100644 index 0000000..bf55bb8 --- /dev/null +++ b/.github/workflows/tradingview.yml @@ -0,0 +1,133 @@ +name: tradingview + +# This workflow uses actions that are not certified by GitHub. +# They are provided by a third-party and are governed by +# separate terms of service, privacy policy, and support +# documentation. + +on: + schedule: + - cron: '0 6 * * 6' # 6 am on Saturdays + push: + paths: + - 'containers/cachyos/tradingview/Dockerfile' + +env: + # Use docker.io for Docker Hub if empty + REGISTRY: ghcr.io + # github.repository as / + IMAGE_NAME: ${{ github.repository_owner }}/containers/cachyos/tradingview + IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }} + + +jobs: + build: + + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + # This is used to complete the identity challenge + # with sigstore/fulcio when running outside of PRs. + id-token: write + + steps: + - name: Maximize build space + uses: AdityaGarg8/remove-unwanted-software@v1 + with: + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y%m%d')" + + - name: Test with environment variables + run: echo $DATE + env: + DATE: ${{ steps.date.outputs.date }} + + - name: Checkout repository + uses: actions/checkout@v3 + + # Install the cosign tool except on PR + # https://github.com/sigstore/cosign-installer + - name: Install cosign + if: github.event_name != 'pull_request' + uses: sigstore/cosign-installer@6e04d228eb30da1757ee4e1dd75a0ec73a653e06 #v3.1.1 + with: + cosign-release: 'v2.1.1' + + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + if: github.event_name != 'pull_request' + uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + # Extract metadata (tags, labels) for Docker + # https://github.com/docker/metadata-action + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + + + # Build image using Buildah action + - name: Build Image + id: build_image + uses: redhat-actions/buildah-build@v2 + with: + containerfiles: | + ./containers/cachyos/tradingview/Dockerfile + image: ${{ env.IMAGE_NAME }} + tags: ${{ steps.meta.outputs.tags }} ${{ steps.meta.outputs.tags }}.${{ steps.date.outputs.date }} + oci: false + layers: false + + # Workaround bug where capital letters in your GitHub username make it impossible to push to GHCR. + # https://github.com/macbre/push-to-ghcr/issues/12 + - name: Lowercase Registry + id: registry_case + uses: ASzc/change-string-case-action@v5 + with: + string: ${{ env.IMAGE_REGISTRY }} + + # Push the image to GHCR (Image Registry) + - name: Push To GHCR + uses: redhat-actions/push-to-registry@v2 + id: push + if: github.event_name != 'pull_request' + env: + REGISTRY_USER: ${{ github.actor }} + REGISTRY_PASSWORD: ${{ github.token }} + with: + image: ${{ steps.build_image.outputs.image }} + tags: ${{ steps.build_image.outputs.tags }} + registry: ${{ steps.registry_case.outputs.lowercase }} + username: ${{ env.REGISTRY_USER }} + password: ${{ env.REGISTRY_PASSWORD }} + extra-args: | + --disable-content-trust + + + + # Sign the resulting Docker image digest except on PRs. + # This will only write to the public Rekor transparency log when the Docker + # repository is public to avoid leaking data. If you would like to publish + # transparency data even for private images, pass --force to cosign below. + # https://github.com/sigstore/cosign + - name: Sign the published Docker image + if: ${{ github.event_name != 'pull_request' }} + env: + # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable + TAGS: ${{ steps.meta.outputs.tags }} + DIGEST: ${{ steps.push.outputs.digest }} + # This step uses the identity token to provision an ephemeral certificate + # against the sigstore community Fulcio instance. + run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST} diff --git a/containers/cachyos/base-gui.Dockerfile b/containers/cachyos/base-gui.Dockerfile new file mode 100644 index 0000000..6ba7690 --- /dev/null +++ b/containers/cachyos/base-gui.Dockerfile @@ -0,0 +1,41 @@ +FROM docker.io/cachyos/cachyos-v3 + +WORKDIR /app +COPY etc /etc + +RUN pacman -Syu --noconfirm --needed git base-devel +RUN useradd -m --shell=/bin/false build && usermod -L build +RUN echo "build ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN echo "root ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers +RUN chown -R build /app +RUN pacman -Sy --noconfirm yay bash bc curl diffutils findutils gnupg less lsof ncurses pinentry procps-ng shadow sudo time util-linux wget vte-common +RUN pacman -Sy --noconfirm fish htop +RUN pacman -Sy --noconfirm libva libva-intel-driver libva-mesa-driver libva-utils intel-media-driver +RUN pacman -Sy --noconfirm mesa opengl-driver vulkan-intel vulkan-radeon +RUN pacman -Sy --noconfirm nss atk cups gtk3 alsa-lib +RUN pacman -Sy --noconfirm xdg-utils +RUN pacman -Sy --noconfirm nano ibus dbus-glib +RUN pacman -Sy --noconfirm ttf-dejavu noto-fonts ttf-liberation +RUN pacman -Sy --noconfirm nvidia-utils +RUN pacman -Sy --noconfirm squashfs-tools python-pyasn1 python-pip qt6-wayland + +RUN pacman -Sy --noconfirm opencl-nvidia +RUN pacman -Sy --noconfirm libxss +RUN pacman -Sy --noconfirm xorg-xwininfo python-setuptools python-pyaes python-rsa python-certifi +RUN pip3 install pip2pkgbuild python-binance pyside6 --break-system-packages +RUN chown -R build /app +RUN mkdir /app/sqlalchemy && chown -R build /app/sqlalchemy +RUN mkdir /app/telethon && chown -R build /app/telethon +USER build +# python-binance sqlalchemy telethon pyside6 + +WORKDIR /app/sqlalchemy +RUN pip2pkgbuild sqlalchemy +RUN makepkg -si --noconfirm + +WORKDIR /app/telethon +RUN pip2pkgbuild telethon +RUN makepkg -si --noconfirm + +RUN rm -rf /app/* +USER root diff --git a/containers/cachyos/build.sh b/containers/cachyos/build.sh new file mode 100755 index 0000000..18e84e3 --- /dev/null +++ b/containers/cachyos/build.sh @@ -0,0 +1,4 @@ +#!/bin/sh + +podman pull docker.io/cachyos/cachyos-v3 +podman build -t andersrh/cachyos/base-gui -f base-gui.Dockerfile . diff --git a/containers/cachyos/etc/pacman.conf__custom b/containers/cachyos/etc/pacman.conf__custom new file mode 100644 index 0000000..0f8c7cf --- /dev/null +++ b/containers/cachyos/etc/pacman.conf__custom @@ -0,0 +1,115 @@ +# +# /etc/pacman.conf +# +# See the pacman.conf(5) manpage for option and repository directives + +# +# GENERAL OPTIONS +# +[options] +# The following paths are commented out with their default values listed. +# If you wish to use different paths, uncomment and update the paths. +#RootDir = / +#DBPath = /var/lib/pacman/ +#CacheDir = /var/cache/pacman/pkg/ +#LogFile = /var/log/pacman.log +#GPGDir = /etc/pacman.d/gnupg/ +#HookDir = /etc/pacman.d/hooks/ +HoldPkg = pacman glibc +#XferCommand = /usr/bin/curl -L -C - -f -o %o %u +#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u +#CleanMethod = KeepInstalled +#UseDelta = 0.7 +Architecture = auto + +#IgnorePkg = +#IgnorePkg = +#IgnoreGroup = + +#NoUpgrade = +#NoExtract = + +# Misc options +#UseSyslog +Color +ILoveCandy +#NoProgressBar +#CheckSpace +VerbosePkgLists +DisableDownloadTimeout +ParallelDownloads = 10 + +# By default, pacman accepts packages signed by keys that its local keyring +# trusts (see pacman-key and its man page), as well as unsigned packages. +SigLevel = Required DatabaseOptional +LocalFileSigLevel = Optional +#RemoteFileSigLevel = Required + +# NOTE: You must run `pacman-key --init` before first using pacman; the local +# keyring can then be populated with the keys of all official Arch Linux +# packagers with `pacman-key --populate archlinux`. + +# +# REPOSITORIES +# - can be defined here or included from another file +# - pacman will search repositories in the order defined here +# - local/custom mirrors can be added here or in separate files +# - repositories listed first will take precedence when packages +# have identical names, regardless of version number +# - URLs will have $repo replaced by the name of the current repo +# - URLs will have $arch replaced by the name of the architecture +# +# Repository entries are of the format: +# [repo-name] +# Server = ServerName +# Include = IncludePath +# +# The header [repo-name] is crucial - it must be present and +# uncommented to enable the repo. +# + +# The testing repositories are disabled by default. To enable, uncomment the +# repo name header and Include lines. You can add preferred servers immediately +# after the header, and they will be used before the default mirrors. + +#[testing] +#Include = /etc/pacman.d/mirrorlist + +[cachyos-v3] +Include = /etc/pacman.d/cachyos-v3-mirrorlist +[cachyos-community-v3] +Include = /etc/pacman.d/cachyos-v3-mirrorlist +[cachyos-extra-v3] +Include = /etc/pacman.d/cachyos-v3-mirrorlist +[cachyos-core-v3] +Include = /etc/pacman.d/cachyos-v3-mirrorlist +[cachyos] +Include = /etc/pacman.d/cachyos-mirrorlist + +[core] +Include = /etc/pacman.d/mirrorlist + +[extra] +Include = /etc/pacman.d/mirrorlist + +#[community-testing] +#Include = /etc/pacman.d/mirrorlist + +[community] +Include = /etc/pacman.d/mirrorlist + +# If you want to run 32 bit applications on your x86_64 system, +# enable the multilib repositories as required here. + +#[multilib-testing] +#Include = /etc/pacman.d/mirrorlist + +[multilib] +Include = /etc/pacman.d/mirrorlist + +# An example of a custom package repository. See the pacman manpage for +# tips on creating your own repositories. +#[custom] +#SigLevel = Optional TrustAll +#Server = file:///home/custompkgs + diff --git a/containers/cachyos/tradingview/Dockerfile b/containers/cachyos/tradingview/Dockerfile new file mode 100644 index 0000000..dfaf1e0 --- /dev/null +++ b/containers/cachyos/tradingview/Dockerfile @@ -0,0 +1,10 @@ +FROM ghcr.io/andersrh/containers/cachyos/base-gui + +WORKDIR /app + +USER build +RUN git clone https://aur.archlinux.org/tradingview.git \ +&& cd tradingview \ +&& makepkg -si --noconfirm \ +&& rm -rf /app/* +USER root diff --git a/containers/cachyos/tradingview/build.sh b/containers/cachyos/tradingview/build.sh new file mode 100755 index 0000000..35bfd7f --- /dev/null +++ b/containers/cachyos/tradingview/build.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +APPNAME="tradingview" + +podman build -t andersrh/cachyos/$APPNAME -f Dockerfile . +podman rm -f $APPNAME +distrobox create --image ghcr.io/andersrh/containers/cachyos/$APPNAME --home ~/containers/$APPNAME/ $APPNAME +distrobox enter $APPNAME -- distrobox-export --app $APPNAME --extra-flags "--enable-features=WaylandWindowDecorations --ozone-platform=wayland"