From aeb5d65e42427208f5f16b58dc47049187b9152b Mon Sep 17 00:00:00 2001 From: sharpenedblade Date: Mon, 24 Jul 2023 15:42:46 +0530 Subject: [PATCH] feat: Build dev container with pre-installed dependencies --- .github/workflows/build-container.yml | 42 +++++++++++++++++++++++++++ Containerfile | 10 +++++++ 2 files changed, 52 insertions(+) create mode 100644 .github/workflows/build-container.yml create mode 100644 Containerfile diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml new file mode 100644 index 0000000..12c0264 --- /dev/null +++ b/.github/workflows/build-container.yml @@ -0,0 +1,42 @@ +name: Create build container +on: + push: + paths: + - Containerfile + +jobs: + build-container: + name: Build container image + runs-on: ubuntu-latest + env: + IMAGE_NAME: fedora-kernel-build + REGISTRY: ghcr.io + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Build container image + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: ${{ env.IMAGE_NAME }} + tags: latest ${{ github.sha }} 38 + containerfiles: | + ./Containerfile + + - name: Log in to ghcr.io + if: github.ref == 'refs/heads/main' + uses: redhat-actions/podman-login@v1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Push to ghcr.io + if: github.ref == 'refs/heads/main' + id: push-to-ghcr + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: ${{ env.REGISTRY }} diff --git a/Containerfile b/Containerfile new file mode 100644 index 0000000..8dab6e9 --- /dev/null +++ b/Containerfile @@ -0,0 +1,10 @@ +FROM fedora:38 +RUN dnf install -y koji git rpmdevtools rpm-sign mock ccache zstd &&\ + dnf clean all &&\ + echo 'config_opts["plugin_conf"]["package_state_enable"] = False + config_opts["macros"]["%_smp_mflags"] = "-j8" + config_opts["plugin_conf"]["ccache_opts"]["compress"] = True + config_opts["plugin_conf"]["root_cache_opts"]["compress_program"] = "zstd" + config_opts["plugin_conf"]["root_cache_opts"]["extension"] = ".zst" + config_opts["plugin_conf"]["hw_info_enable"] = False' > /etc/mock/site-defaults.cfg +WORKDIR /repo \ No newline at end of file