diff --git a/.gitea/workflows/almalinux9.yaml b/.gitea/workflows/almalinux.yaml similarity index 56% rename from .gitea/workflows/almalinux9.yaml rename to .gitea/workflows/almalinux.yaml index b6b1af4..2841813 100644 --- a/.gitea/workflows/almalinux9.yaml +++ b/.gitea/workflows/almalinux.yaml @@ -29,6 +29,43 @@ jobs: # uses: docker/setup-qemu-action@v3 - name: Setup Docker buildx uses: docker/setup-buildx-action@v3 + - name: Build and push almalinux8-micro + uses: docker/build-push-action@v5 + with: + # platforms: linux/amd64,linux/arm64 + push: true + context: . + file: ./8/Dockerfile.micro + build-args: | + ALMALINUX_VERSION=8.10 + tags: | + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:8.10-micro + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:8-micro + - name: Build and push almalinux8 + uses: docker/build-push-action@v5 + with: + # platforms: linux/amd64,linux/arm64 + push: true + context: . + file: ./8/Dockerfile.default + build-args: | + ALMALINUX_VERSION=8.10 + tags: | + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:8.10 + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:8 + - name: Build and push almalinux9-micro + uses: docker/build-push-action@v5 + with: + # platforms: linux/amd64,linux/arm64 + push: true + context: . + file: ./9/Dockerfile.micro + build-args: | + ALMALINUX_VERSION=9.5 + tags: | + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5-micro + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9-micro + ${{ vars.DOCKERHUB_USERNAME }}/almalinux:micro - name: Build and push almalinux9 uses: docker/build-push-action@v5 with: @@ -42,27 +79,15 @@ jobs: ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5 ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9 ${{ vars.DOCKERHUB_USERNAME }}/almalinux:latest - - name: Build and push almalinux9-micro - uses: docker/build-push-action@v5 - with: - # platforms: linux/amd64,linux/arm64 - push: true - context: . - file: ./9/Dockerfile.micro - build-args: | - ALMALINUX_VERSION=9.5 - tags: | - ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5-micro - ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9-micro - - name: Scan almalinux9 image with Trivy - uses: aquasecurity/trivy-action@0.20.0 - with: - image-ref: '${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5' - format: 'sarif' - output: 'trivy-results.sarif' - - name: Scan almalinux9-micro image with Trivy - uses: aquasecurity/trivy-action@0.20.0 - with: - image-ref: '${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5-micro' - format: 'sarif' - output: 'trivy-results.sarif' + # - name: Scan almalinux9 image with Trivy + # uses: aquasecurity/trivy-action@0.20.0 + # with: + # image-ref: '${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5' + # format: 'sarif' + # output: 'trivy-results.sarif' + # - name: Scan almalinux9-micro image with Trivy + # uses: aquasecurity/trivy-action@0.20.0 + # with: + # image-ref: '${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5-micro' + # format: 'sarif' + # output: 'trivy-results.sarif' diff --git a/10/Dockerfile.default b/10/Dockerfile.default new file mode 100644 index 0000000..e69de29 diff --git a/8/Dockerfile.default b/8/Dockerfile.default new file mode 100644 index 0000000..3291906 --- /dev/null +++ b/8/Dockerfile.default @@ -0,0 +1,84 @@ +ARG ALMALINUX_VERSION=9.5 + +FROM docker.io/almalinux:${ALMALINUX_VERSION} AS builder + +RUN mkdir -p /mnt/rootfs; \ + dnf -y install \ + almalinux-release \ + bash \ + coreutils-single \ + crypto-policies-scripts \ + findutils \ + gdb-gdbserver \ + glibc-minimal-langpack \ + gzip \ + langpacks-en \ + libuser \ + passwd \ + rootfiles \ + systemd \ + tar \ + usermode \ + vim-minimal \ + virt-what \ + which \ + yum \ + --installroot /mnt/rootfs --releasever 8 --setopt install_weak_deps=false --nodocs ; + +# Additional hacks for kickstart file and backward compatable support +RUN rm -rf /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/log/yum.* /mnt/rootfs/var/cache/dnf/* /mnt/rootfs/var/lib/dnf/repos; \ + rm -rf /mnt/rootfs/var/log/hawkey.log /mnt/rootfs/boot /mnt/rootfs/dev/null /mnt/rootfs/var/log/* /mnt/rootfs/run/blkid ; \ + mkdir -p /mnt/rootfs/run/lock; \ + # generate build time file for compatibility with CentOS /mnt/rootfs/run/* /mnt/rootfs/var/lib/dnf/history* + /bin/date +%Y%m%d_%H%M > /mnt/rootfs/etc/BUILDTIME; \ + echo '%_install_langs C.utf8' > /mnt/rootfs/etc/rpm/macros.image-language-conf; \ + echo 'LANG="C.utf8"' > /mnt/rootfs/etc/locale.conf; \ + echo 'container' > /mnt/rootfs/etc/dnf/vars/infra; \ + touch /mnt/rootfs/etc/.pwd.lock; \ + chmod 600 /mnt/rootfs/etc/.pwd.lock; \ + touch /mnt/rootfs/run/utmp ;\ + chmod 664 /mnt/rootfs/run/utmp ;\ + echo '0.000000 1728971976 0.000000' > /mnt/rootfs/etc/adjtime; \ + echo '1728971976' >> /mnt/rootfs/etc/adjtime; \ + echo 'LOCAL' >> /mnt/rootfs/etc/adjtime; \ + # echo '# This file has been generated by the Anaconda Installer.' > /mnt/rootfs/etc/sysconfig/sshd-permitrootlogin ;\ + # echo '# Allow root to log in using ssh. Remove this file to opt-out.' >> /mnt/rootfs/etc/sysconfig/sshd-permitrootlogin ;\ + # echo 'PERMITROOTLOGIN="-oPermitRootLogin=yes"' >> /mnt/rootfs/etc/sysconfig/sshd-permitrootlogin ;\ + echo 'KEYMAP="us"' > /mnt/rootfs/etc/vconsole.conf; \ + echo 'FONT="eurlatgr"' >> /mnt/rootfs/etc/vconsole.conf; \ + rm -rf /mnt/rootfs/usr/share/locale/en_CA/ /mnt/rootfs/usr/share/locale/en_GB/ /mnt/rootfs/usr/share/locale/en@* /mnt/rootfs/usr/share/locale/en /mnt/rootfs/usr/share/locale/en*@* /mnt/rootfs/usr/share/i18n/charmaps /mnt/rootfs/usr/share/i18n/locales ;\ + rm -f /mnt/rootfs/etc/machine-id; \ + touch /mnt/rootfs/etc/machine-id; \ + touch /mnt/rootfs/etc/resolv.conf; \ + touch /mnt/rootfs/etc/hostname + +FROM scratch as stage2 + +COPY --from=builder /mnt/rootfs/ / + +RUN systemctl set-default multi-user.target; \ + systemctl mask systemd-remount-fs.service \ + dev-hugepages.mount \ + sys-fs-fuse-connections.mount \ + systemd-logind.service \ + getty.target \ + console-getty.service + +FROM scratch + +LABEL maintainer="Muhamad Aditya Prima " +LABEL name="almalinux" +LABEL version="${ALMALINUX_VERSION}" +LABEL distribution-scope="public" + +#labels for container catalog +LABEL summary="Almalinux 8 container image" +LABEL description="Provide latest release of Almalinux 8 container image" +LABEL io.k8s.description="Almalinux 8" +LABEL io.k8s.display-name="Almalinux 8" + +COPY --from=stage2 / / + +ENV LANG=C.utf8 + +CMD ["/bin/bash"] \ No newline at end of file diff --git a/8/Dockerfile.micro b/8/Dockerfile.micro new file mode 100644 index 0000000..76b9402 --- /dev/null +++ b/8/Dockerfile.micro @@ -0,0 +1,51 @@ +ARG ALMALINUX_VERSION=9.5 + +FROM docker.io/almalinux:${ALMALINUX_VERSION} AS builder + +RUN mkdir -p /mnt/rootfs; \ + dnf install --installroot /mnt/rootfs \ + coreutils-single \ + glibc-minimal-langpack \ + --releasever 8 --setopt install_weak_deps=false --nodocs -y; \ + dnf --installroot /mnt/rootfs clean all; + +# Additional hacks for kickstart file and backward compatable support +RUN rm -rf /mnt/rootfs/var/cache/dnf /mnt/rootfs/var/log/dnf* /mnt/rootfs/var/lib/dnf /mnt/rootfs/var/log/yum.* /mnt/rootfs/var/lib/rpm/* ; \ + /bin/date +%Y%m%d_%H%M > /mnt/rootfs/etc/BUILDTIME ; \ + echo '%_install_langs C.utf8' > /mnt/rootfs/etc/rpm/macros.image-language-conf; \ + echo 'LANG="C.utf8"' > /mnt/rootfs/etc/locale.conf; \ + echo 'container' > /mnt/rootfs/etc/dnf/vars/infra; \ + rm -f /mnt/rootfs/etc/machine-id; \ + touch /mnt/rootfs/etc/machine-id; \ + touch /mnt/rootfs/etc/.pwd.lock; \ + touch /mnt/rootfs/etc/resolv.conf; \ + touch /mnt/rootfs/etc/hostname; \ + chmod 600 /mnt/rootfs/etc/.pwd.lock; \ + rm -rf /mnt/rootfs/usr/share/locale/en* /mnt/rootfs/boot /mnt/rootfs/dev/null /mnt/rootfs/var/log/hawkey.log; \ + echo '0.000000 1728971976 0.000000' > /mnt/rootfs/etc/adjtime; \ + echo '1728971976' >> /mnt/rootfs/etc/adjtime; \ + echo 'LOCAL' >> /mnt/rootfs/etc/adjtime; \ + # echo '# This file has been generated by the Anaconda Installer.' > /mnt/rootfs/etc/sysconfig/sshd-permitrootlogin ;\ + # echo '# Allow root to log in using ssh. Remove this file to opt-out.' >> /mnt/rootfs/etc/sysconfig/sshd-permitrootlogin ;\ + # echo 'PERMITROOTLOGIN="-oPermitRootLogin=yes"' >> /mnt/rootfs/etc/sysconfig/sshd-permitrootlogin ;\ + echo 'KEYMAP="us"' > /mnt/rootfs/etc/vconsole.conf; \ + echo 'FONT="eurlatgr"' >> /mnt/rootfs/etc/vconsole.conf; \ + cd /mnt/rootfs/etc ; \ + ln -s ../usr/share/zoneinfo/Asia/Jakarta localtime + +FROM scratch + +LABEL maintainer="Muhamad Aditya Prima " +LABEL name="almalinux-micro" +LABEL version="${ALMALINUX_VERSION}" +LABEL distribution-scope="public" + +#labels for container catalog +LABEL summary="Almalinux 9 micro container image" +LABEL description="Provide latest release of micro Almalinux 9 container base image" +LABEL io.k8s.description="Very small almalinux 9 based image which doesn't install package manager" +LABEL io.k8s.display-name="Almalinux 9 Micro" + +COPY --from=system-build /mnt/rootfs/ / + +CMD ["/bin/sh"] \ No newline at end of file diff --git a/9/Dockerfile.default b/9/Dockerfile.default index f7c79af..d90aabd 100644 --- a/9/Dockerfile.default +++ b/9/Dockerfile.default @@ -2,11 +2,8 @@ ARG ALMALINUX_VERSION=9.5 FROM docker.io/almalinux:${ALMALINUX_VERSION} AS builder -# Prepare temporary rootfs -RUN mkdir -p /mnt/rootfs - -# Install almalinux-release and import GPG Key -RUN \ +# Install almalinux-release and required dependencies +RUN mkdir -p /mnt/rootfs; \ dnf -y install --installroot /mnt/rootfs \ almalinux-release \ bash \ diff --git a/README.md b/README.md index aa11207..57fcc57 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Almalinux Container Images -Built with buildah, contains preinstalled epel-release and timezone changed to Asia/Jakarta +Built with docker, contains preinstalled epel-release and timezone changed to Asia/Jakarta Build: