From 0821ebf67d12c2e8476227086bee58007a970894 Mon Sep 17 00:00:00 2001 From: f-bn Date: Fri, 13 Oct 2023 23:21:13 +0200 Subject: [PATCH] feat: add initial ubuntu image --- .github/workflows/ubuntu.yml | 49 ++++++++++++++++++++++++++++++++++++ README.md | 2 +- ubuntu/Dockerfile.jammy | 16 ++++++++++++ 3 files changed, 66 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ubuntu.yml create mode 100644 ubuntu/Dockerfile.jammy diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml new file mode 100644 index 0000000..18425bc --- /dev/null +++ b/.github/workflows/ubuntu.yml @@ -0,0 +1,49 @@ +--- +name: Build Ubuntu Molecule image +on: + push: + branches: + - main + paths: + - ubuntu/** + - .github/workflows/ubuntu.yml +# schedule: +# - cron: '' +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + release: ['jammy'] + steps: + - name: Generate build id (based on timestamp) + run: | + echo BUILD_ID=$(date +'%Y%m%d%H%M') >> $GITHUB_ENV + + - name: Check-out repository + uses: actions/checkout@v4 + + - name: Set up QEMU (for multi-arch build) + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to Docker Hub registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.REGISTRY_HUB_USERNAME }} + password: ${{ secrets.REGISTRY_HUB_PASSWORD }} + + - name: Build and push image to Docker Hub registry + uses: docker/build-push-action@v5 + with: + platforms: linux/amd64,linux/arm64 + context: ./ubuntu + file: ./ubuntu/Dockerfile.${{ matrix.release }} + push: true + build-args: | + RELEASE=${{ matrix.release }} + tags: | + ${{ secrets.REGISTRY_HUB_USERNAME }}/molecule-ubuntu:${{ matrix.release }} + ${{ secrets.REGISTRY_HUB_USERNAME }}/molecule-ubuntu:${{ matrix.release }}-${{ env.BUILD_ID }} \ No newline at end of file diff --git a/README.md b/README.md index d5af82c..4676ec7 100644 --- a/README.md +++ b/README.md @@ -6,4 +6,4 @@ Custom images for Ansible Molecule testing in GitHub Actions. | Name | Tags | Architectures | | :-------------------------| :------------------| :------------------| -| [molecule-ubuntu](ubuntu/)| `22.04` | `x86_64`,`aarch64` | +| [molecule-ubuntu](ubuntu/)| `jammy` | `x86_64`,`aarch64` | diff --git a/ubuntu/Dockerfile.jammy b/ubuntu/Dockerfile.jammy new file mode 100644 index 0000000..5a4e046 --- /dev/null +++ b/ubuntu/Dockerfile.jammy @@ -0,0 +1,16 @@ +ARG RELEASE="jammy" + +FROM public.ecr.aws/ubuntu/ubuntu:${RELEASE}_stable + +RUN set -ex ; \ + export DEBIAN_FRONTEND=noninteractive; \ + apt update ; \ + apt install -y systemd systemd-sysv iproute2 python3 sudo hostname procps ca-certificates gnupg ; \ + apt clean all ; \ + rm -rf /var/lib/apt/lists/* ; + +RUN truncate -s0 /etc/machine-id + +STOPSIGNAL SIGRTMIN+3 + +CMD [ "/sbin/init" ] \ No newline at end of file