From 29da8c271eb83f97e87c7af5ee0c4730974bbdfd Mon Sep 17 00:00:00 2001 From: Ettore Di Giacinto Date: Tue, 13 Sep 2022 20:41:45 +0000 Subject: [PATCH] Add tool-image --- .github/workflows/tool-image.yml | 63 ++++++++++++++++++++++++++++++++ tools-image/Dockerfile | 21 +++++++++++ tools-image/config.yaml | 6 +++ tools-image/entrypoint.sh | 5 +++ 4 files changed, 95 insertions(+) create mode 100644 .github/workflows/tool-image.yml create mode 100644 tools-image/Dockerfile create mode 100644 tools-image/config.yaml create mode 100755 tools-image/entrypoint.sh diff --git a/.github/workflows/tool-image.yml b/.github/workflows/tool-image.yml new file mode 100644 index 0000000..8a42ddc --- /dev/null +++ b/.github/workflows/tool-image.yml @@ -0,0 +1,63 @@ +--- +name: 'build tools container images' + +on: + push: + branches: + - master + tags: + - '*' + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Prepare + id: prep + run: | + DOCKER_IMAGE=quay.io/c3os/osbuilder-tools + VERSION=latest + SHORTREF=${GITHUB_SHA::8} + # If this is git tag, use the tag name as a docker tag + if [[ $GITHUB_REF == refs/tags/* ]]; then + VERSION=${GITHUB_REF#refs/tags/} + fi + TAGS="${DOCKER_IMAGE}:${VERSION},${DOCKER_IMAGE}:${SHORTREF}" + # If the VERSION looks like a version number, assume that + # this is the most recent version of the image and also + # tag it 'latest'. + if [[ $VERSION =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then + TAGS="$TAGS,${DOCKER_IMAGE}:latest" + fi + # Set output parameters. + echo ::set-output name=tags::${TAGS} + echo ::set-output name=docker_image::${DOCKER_IMAGE} + - name: Set up QEMU + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@master + + - name: Login to DockerHub + if: github.event_name != 'pull_request' + uses: docker/login-action@v1 + with: + registry: quay.io + username: ${{ secrets.QUAY_USERNAME }} + password: ${{ secrets.QUAY_PASSWORD }} + + - name: Build + uses: docker/build-push-action@v2 + with: + builder: ${{ steps.buildx.outputs.name }} + context: ./tools-image + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ steps.prep.outputs.tags }} diff --git a/tools-image/Dockerfile b/tools-image/Dockerfile new file mode 100644 index 0000000..8ab3945 --- /dev/null +++ b/tools-image/Dockerfile @@ -0,0 +1,21 @@ +ARG ELEMENTAL_CLI_VERSION=v0.0.15-ae4f000 +ARG LEAP_VERSION=15.4 +FROM quay.io/costoolkit/elemental-cli:$ELEMENTAL_CLI_VERSION AS elemental + +FROM quay.io/costoolkit/releases-teal:grub2-live-0.0.3-2 AS grub2 +FROM quay.io/costoolkit/releases-teal:grub2-efi-image-live-0.0.2-2 AS efi + +FROM opensuse/leap:$LEAP_VERSION +COPY --from=elemental /usr/bin/elemental /usr/bin/elemental + +COPY --from=grub2 / /grub2 +COPY --from=efi / /efi + +RUN zypper ref && zypper dup -y +RUN zypper ref && zypper in -y xfsprogs parted util-linux-systemd e2fsprogs util-linux udev rsync grub2 dosfstools grub2-x86_64-efi squashfs mtools xorriso lvm2 +RUN mkdir /config + +COPY ./config.yaml /config/manifest.yaml +COPY ./entrypoint.sh /entrypoint.sh + +ENTRYPOINT [ "/entrypoint.sh" ] \ No newline at end of file diff --git a/tools-image/config.yaml b/tools-image/config.yaml new file mode 100644 index 0000000..4ceb56c --- /dev/null +++ b/tools-image/config.yaml @@ -0,0 +1,6 @@ +iso: + uefi: + - dir:/efi + image: + - dir:/efi + - dir:/grub2 \ No newline at end of file diff --git a/tools-image/entrypoint.sh b/tools-image/entrypoint.sh new file mode 100755 index 0000000..dc0f4f7 --- /dev/null +++ b/tools-image/entrypoint.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +set -ex + +elemental --config-dir /config $@ \ No newline at end of file