Add tool-image

This commit is contained in:
Ettore Di Giacinto 2022-09-13 20:41:45 +00:00
parent 2997c7aa2f
commit 29da8c271e
4 changed files with 95 additions and 0 deletions

63
.github/workflows/tool-image.yml vendored Normal file
View File

@ -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 }}

21
tools-image/Dockerfile Normal file
View File

@ -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" ]

6
tools-image/config.yaml Normal file
View File

@ -0,0 +1,6 @@
iso:
uefi:
- dir:/efi
image:
- dir:/efi
- dir:/grub2

5
tools-image/entrypoint.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
set -ex
elemental --config-dir /config $@