Added almalinux8
Build and push Almalinux 9 container images / Build almalinux base container images (push) Failing after 37s Details

This commit is contained in:
Muhamad Aditya Prima 2024-12-15 15:38:43 +07:00
parent 3a1a021afc
commit 81357694ae
6 changed files with 187 additions and 30 deletions

View File

@ -29,6 +29,43 @@ jobs:
# uses: docker/setup-qemu-action@v3 # uses: docker/setup-qemu-action@v3
- name: Setup Docker buildx - name: Setup Docker buildx
uses: docker/setup-buildx-action@v3 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 - name: Build and push almalinux9
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
@ -42,27 +79,15 @@ jobs:
${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5 ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5
${{ vars.DOCKERHUB_USERNAME }}/almalinux:9 ${{ vars.DOCKERHUB_USERNAME }}/almalinux:9
${{ vars.DOCKERHUB_USERNAME }}/almalinux:latest ${{ vars.DOCKERHUB_USERNAME }}/almalinux:latest
- name: Build and push almalinux9-micro # - name: Scan almalinux9 image with Trivy
uses: docker/build-push-action@v5 # uses: aquasecurity/trivy-action@0.20.0
with: # with:
# platforms: linux/amd64,linux/arm64 # image-ref: '${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5'
push: true # format: 'sarif'
context: . # output: 'trivy-results.sarif'
file: ./9/Dockerfile.micro # - name: Scan almalinux9-micro image with Trivy
build-args: | # uses: aquasecurity/trivy-action@0.20.0
ALMALINUX_VERSION=9.5 # with:
tags: | # image-ref: '${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5-micro'
${{ vars.DOCKERHUB_USERNAME }}/almalinux:9.5-micro # format: 'sarif'
${{ vars.DOCKERHUB_USERNAME }}/almalinux:9-micro # 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'

0
10/Dockerfile.default Normal file
View File

84
8/Dockerfile.default Normal file
View File

@ -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 <aprimediet@gmail.com>"
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"]

51
8/Dockerfile.micro Normal file
View File

@ -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 <aprimediet@gmail.com>"
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"]

View File

@ -2,11 +2,8 @@ ARG ALMALINUX_VERSION=9.5
FROM docker.io/almalinux:${ALMALINUX_VERSION} AS builder FROM docker.io/almalinux:${ALMALINUX_VERSION} AS builder
# Prepare temporary rootfs # Install almalinux-release and required dependencies
RUN mkdir -p /mnt/rootfs RUN mkdir -p /mnt/rootfs; \
# Install almalinux-release and import GPG Key
RUN \
dnf -y install --installroot /mnt/rootfs \ dnf -y install --installroot /mnt/rootfs \
almalinux-release \ almalinux-release \
bash \ bash \

View File

@ -1,6 +1,6 @@
# Almalinux Container Images # 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: Build: