From 8cb506542e4f707e36cb0878e7c40e12da70bb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Vydra?= Date: Thu, 14 Aug 2025 16:06:13 +0200 Subject: [PATCH 1/3] Drop VBox support, update to Ubuntu 24.04 --- .github/workflows/docker-image.yml | 29 ++++++++++++++++++++++++ Dockerfile | 36 +++++------------------------- 2 files changed, 34 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/docker-image.yml diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml new file mode 100644 index 0000000..0202706 --- /dev/null +++ b/.github/workflows/docker-image.yml @@ -0,0 +1,29 @@ +name: Docker Image CI +on: + push: + workflow_dispatch: +jobs: + build: + runs-on: gha-runner-scale-set + container: + image: gcr.io/kaniko-project/executor:debug + permissions: + contents: read + packages: write + steps: + - name: Configure Docker Authentication + run: | + mkdir -p /kaniko/.docker + echo '{"auths":{"ghcr.io":{"auth":"'"$(echo -n $GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }} | base64)"'"}}}' > /kaniko/.docker/config.json + + - name: Build and Push Docker Image + env: + IMAGE_NAME: docker-image-builder + GIT_USERNAME: "kaniko-bot" + GIT_PASSWORD: "${{ secrets.GITHUB_TOKEN }}" + run: | + /kaniko/executor \ + --context="${{ github.repositoryUrl }}#${{ github.ref }}#${{ github.sha }}" \ + --dockerfile ./Dockerfile \ + --destination=ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}:${{ github.sha }} \ + $(if [ "${GITHUB_REF_NAME}" = "master" ]; then echo "--destination ghcr.io/${{ github.repository_owner }}/${IMAGE_NAME}:latest"; fi) diff --git a/Dockerfile b/Dockerfile index 47858f3..99f667d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ -FROM ubuntu:22.04 +FROM ubuntu:24.04 # Prerequisities -RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y tzdata --no-install-recommends && apt-get install -y --no-install-recommends \ +RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y --no-install-recommends \ ca-certificates \ lsb-release \ openssh-client \ @@ -11,23 +11,12 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y tzdata - jq \ wget \ software-properties-common \ - xvfb \ git \ - libarchive-tools \ rsync # QEMU RUN DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends qemu-kvm ebtables libguestfs-tools -# Virtualbox -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y linux-headers-generic virtualbox - -RUN VIRTUALBOX_VERSION=`VBoxManage --version | sed -r -e '/[0-9]+\.[0-9]+\.[0-9]+/!d' -e 's/.*([0-9]+\.[0-9]+\.[0-9]+).*/\1/'` && \ - wget -q https://download.virtualbox.org/virtualbox/${VIRTUALBOX_VERSION}/Oracle_VM_VirtualBox_Extension_Pack-${VIRTUALBOX_VERSION}.vbox-extpack && \ - echo "y" | VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-${VIRTUALBOX_VERSION}.vbox-extpack && \ - rm Oracle_VM_VirtualBox_Extension_Pack-${VIRTUALBOX_VERSION}.vbox-extpack && \ - VBoxManage setproperty vrdeextpack "Oracle VM VirtualBox Extension Pack" - # Packer RUN PACKER_VERSION=$(wget -O- https://releases.hashicorp.com/packer/ 2> /dev/null \ | sed -r -e 's/.*packer_([0-9]+\.[0-9]+\.[0-9]+)<\/a>.*/\1/' -e '/^[0-9]+\.[0-9]+\.[0-9]+$/!d' \ @@ -39,31 +28,16 @@ RUN PACKER_VERSION=$(wget -O- https://releases.hashicorp.com/packer/ 2> /dev/nul mv packer /usr/local/bin && \ rm packer.zip -# Vagrant -RUN VAGRANT_VERSION=$(wget -O- https://releases.hashicorp.com/vagrant/ 2> /dev/null \ - | sed -r -e 's/.*vagrant_([0-9]+\.[0-9]+\.[0-9]+)<\/a>.*/\1/' -e '/^[0-9]+\.[0-9]+\.[0-9]+$/!d' \ - | sort --version-sort --reverse \ - | head -n 1) && \ - wget -q -O vagrant.zip https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_linux_amd64.zip && \ - unzip vagrant.zip && \ - chmod +x vagrant && \ - mv vagrant /usr/local/bin && \ - rm vagrant.zip - # Openstack-cli RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-openstackclient s3cmd zip # Ansible -#RUN apt-add-repository --yes --update ppa:ansible/ansible -#RUN apt-get install -y ansible -RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip && pip3 install ansible pywinrm +RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip && pip3 install ansible pywinrm --break-system-packages -# GitLab-Tofu +# Tofu RUN curl --proto '=https' --tlsv1.2 -fsSL https://get.opentofu.org/install-opentofu.sh -o install-opentofu.sh && \ chmod +x install-opentofu.sh && \ ./install-opentofu.sh --install-method standalone && \ - rm ./install-opentofu.sh && \ - curl --proto '=https' --tlsv1.2 -fsSL https://gitlab.com/components/opentofu/-/raw/main/src/gitlab-tofu.sh -o /usr/bin/gitlab-tofu && \ - chmod 755 /usr/bin/gitlab-tofu + rm ./install-opentofu.sh RUN apt-get -y clean From 04fb1f616d8a7d72951851d76a6c59764664367d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Vydra?= Date: Thu, 14 Aug 2025 16:07:34 +0200 Subject: [PATCH 2/3] Set runner --- .github/workflows/docker-image.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 0202706..90cc8ab 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -4,7 +4,7 @@ on: workflow_dispatch: jobs: build: - runs-on: gha-runner-scale-set + runs-on: ["self-hosted", "images"] container: image: gcr.io/kaniko-project/executor:debug permissions: From 0025dec09d87ce67237df442b1b78d1aecbc25ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Vydra?= Date: Thu, 14 Aug 2025 16:29:44 +0200 Subject: [PATCH 3/3] Update README --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 81c1f58..5cbbca0 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ # Docker Image Builder -This repository contains definition of a Docker image with QEMU, VBox, Packer, Vagrant, OpenStack-cli and Ansible, which is used in [ci-cd-virtual-images](https://gitlab.ics.muni.cz/muni-kypo-images/ci-cd-virtual-images). - -The Docker image is also available on [Docker Hub](https://hub.docker.com/repository/docker/munikypo/packer-vbox-qemu). +This repository contains definition of a Docker image with QEMU, Packer, Ansible and OpenTofu. ## Example usage ```bash @@ -14,5 +12,4 @@ sudo docker run --rm -it --privileged --network=host -w /opt -v `pwd`:/opt packe ``` ## License - This project is licensed under the [MIT License](LICENSE).