### Minimal Containerfile for AlmaLinux 9 Source: https://github.com/almalinux/container-images/blob/main/README.md An example Containerfile for building a minimal container image for AlmaLinux release 9. It uses dnf to install packages into a root filesystem and then copies it to a scratch image. ```Dockerfile ARG SYSBASE=almalinux:9 FROM ${SYSBASE} as system-build RUN mkdir /mnt/sys-root; \ dnf install -y \ --installroot /mnt/sys-root \ --releasever 9 \ --setopt install_weak_deps=false \ --nodocs \ almalinux-release \ bash \ ... FROM scratch COPY --from=system-build /mnt/sys-root/ / CMD ["/bin/bash"] ``` -------------------------------- ### Minimal Dockerfile for AlmaLinux 9 amd64 Source: https://github.com/almalinux/container-images/blob/main/README.md A Dockerfile example for building a minimal container image for AlmaLinux release 9 on the amd64 platform, intended for the Docker Official Library. It starts from a scratch image and adds a pre-compressed tarball. ```Dockerfile # Tags: minimal, 9-minimal, 9.3-minimal, 9.3-minimal-20231124 FROM scratch ADD almalinux-9-minimal-amd64.tar.xz / CMD ["/bin/bash"] ``` -------------------------------- ### Build AlmaLinux 8 Minimal Images Source: https://github.com/almalinux/container-images/blob/main/README.md Builds container images using docker/build-push-action. This example specifies platforms, disables provenance, loads images locally, and includes tags generated by metadata-action. It targets AlmaLinux 8 minimal images. ```sh /usr/bin/docker buildx build --file ./Containerfile.minimal ... \ --platform linux/386,linux/amd64,linux/ppc64le,linux/s390x,linux/arm64 \ --provenance false ... \ --tag docker.io/***/8-minimal:latest --tag docker.io/***/8-minimal:8 --tag docker.io/***/8-minimal:8.9 --tag docker.io/***/8-minimal:8.9-20240319 --tag quay.io/***/8-minimal:latest --tag quay.io/***/8-minimal:8 --tag quay.io/***/8-minimal:8.9 --tag quay.io/***/8-minimal:8.9-20240319 \ --load \ --metadata-file /home/runner/work/_temp/docker-actions-toolkit-*/metadata-file \ https://github.com/***/container-images.git#270a6d3fd433cfa6c3e1fff5896a92d1ae2896be:Containerfiles/8 ``` -------------------------------- ### Get Package Architecture Source: https://github.com/almalinux/container-images/blob/main/README.md Use this command to determine the package architecture. For the 'micro' image, 'uname -m' is used instead. ```bash rpm -qf --queryformat '%{ARCH}' /etc/almalinux-release ``` -------------------------------- ### Generate Image Tags and Metadata Source: https://github.com/almalinux/container-images/blob/main/README.md Uses docker/metadata-action to generate tags, labels, and annotations for container images. Example shows tags for AlmaLinux 8 minimal image. ```json "tags": [ "docker.io/***/8-minimal:latest", "docker.io/***/8-minimal:8", "docker.io/***/8-minimal:8.9", "docker.io/***/8-minimal:8.9-20240319", "quay.io/***/8-minimal:latest", "quay.io/***/8-minimal:8", "quay.io/***/8-minimal:8.9", "quay.io/***/8-minimal:8.9-20240319" ] ``` -------------------------------- ### Build, Test, and Push Workflow Source: https://github.com/almalinux/container-images/blob/main/README.md This GitHub Actions workflow is used to build, test, and push container images to the Client Library. It is triggered manually via workflow_dispatch and accepts a boolean input for production pushes. ```yaml name: Build, test and push to the Client Library on: workflow_dispatch: inputs: production: description: | 'Push to production registries' 'not checked - to testing' required: true type: boolean default: true ... ``` -------------------------------- ### AlmaLinux 9.5 Micro Image Details Source: https://github.com/almalinux/container-images/blob/main/README.md Provides details about the AlmaLinux 9.5 micro image, including its build version and available tags. ```text AlmaLinux OS 9.5 Container Image, build `20250411091645`, generated by the [GitHub Action](https://github.com/AlmaLinux/container-images/actions/runs/14399603789) Platforms: ``` linux/386, linux/amd64, linux/ppc64le, linux/s390x, linux/arm64 ``` :almalinux: micro ``` quay.io/almalinuxorg/9-micro:latest quay.io/almalinuxorg/9-micro:9 quay.io/almalinuxorg/9-micro:9.5 quay.io/almalinuxorg/9-micro:9.5-20250411 ``` ``` -------------------------------- ### Configure Platforms in GitHub Actions Workflow Source: https://github.com/almalinux/container-images/blob/main/README.md Define the target platforms for building container images in the build-test-push.yml workflow file. Separate platforms with commas. ```yaml platforms: 'linux/amd64, linux/ppc64le, linux/s390x, linux/arm64' ``` -------------------------------- ### Configure Image Types for Build Matrix (Workflow Dispatch) Source: https://github.com/almalinux/container-images/blob/main/README.md Set the image types matrix for the build when using workflow dispatch in the build-test-push.yml file. ```bash workflow_dispatch) ... echo "image_types_matrix=$(jq -c <<< '[${{ format('"{0}"', ( inputs.type_default && '' ) ) }}]') ``` -------------------------------- ### Configure Registries in GitHub Actions Workflow Source: https://github.com/almalinux/container-images/blob/main/README.md Specify production and testing registries in the build-test-push.yml workflow file. Replace `` with your actual username for each registry. ```yaml registries_production: 'docker.io/, quay.io/, ghcr.io/' registries_testing: 'docker.io/, quay.io/, ghcr.io/' ``` -------------------------------- ### Checkout Container Images Repository Source: https://github.com/almalinux/container-images/blob/main/README.md Checks out the 'main' branch of the container-images repository using the actions/checkout@v6 action. Only the latest commit is fetched. ```sh actions/checkout@v6 ``` -------------------------------- ### Verify Containerd Image Store Activation Source: https://github.com/almalinux/container-images/blob/main/README.md Confirms that the containerd image store has been successfully enabled by checking the Docker info output. ```text [[driver-type io.containerd.snapshotter.v1]] ``` -------------------------------- ### Checkout Container Images Repository Source: https://github.com/almalinux/container-images/blob/main/README.md Checks out the container-images repository for a specific branch with fetch-depth set to 0. ```yaml - name: Checkout almalinux/container-images, branch '${version_major}', path '${version_major}' uses: actions/checkout@v6 with: repository: almalinux/container-images ref: '${version_major}' path: '${version_major}' fetch-depth: 0 ``` -------------------------------- ### Test Container Image Source: https://github.com/almalinux/container-images/blob/main/README.md Tests a container image by running a command inside it to verify the release string and architecture. The output is piped to grep for validation. ```sh docker run --platform=${platform} ${digest} /bin/bash -c " \ echo \"\\\$(cat /etc/almalinux-release) \ $(${arch_query})\"" | \ grep -E "${release_string}.*${expected_arch}" ``` -------------------------------- ### Configure Image Types for Scheduled Workflow Source: https://github.com/almalinux/container-images/blob/main/README.md Define the list of image types for the build in the build-test-push.yml file for scheduled workflows. Separate types with commas and enclose each in double quotes. ```yaml env: ... image_types: '"", ""' ``` -------------------------------- ### Configure Containerd Image Store for Docker Source: https://github.com/almalinux/container-images/blob/main/README.md Enables the containerd image store by modifying the Docker daemon configuration. The Docker service must be restarted for the changes to take effect. ```json { "features": { "containerd-snapshotter": true } } ``` -------------------------------- ### Set AlmaLinux Versions List for Scheduled Workflows Source: https://github.com/almalinux/container-images/blob/main/README.md Specify the AlmaLinux versions to be processed by scheduled workflows. Versions should be comma-separated and enclosed in double quotes. ```yaml env: ... versions_list: '"8", "9", ""' ``` -------------------------------- ### Define AlmaLinux Major Version Input Source: https://github.com/almalinux/container-images/blob/main/README.md Configure the major AlmaLinux version as a choice input for workflow dispatch. Ensure the default is set to the latest available version. ```yaml version_major: description: 'AlmaLinux major version' required: true default: '' type: choice options: - - 9 - 8 ``` -------------------------------- ### Docker Library Definition Template Source: https://github.com/almalinux/container-images/blob/main/README.md A template file used to generate the Definition file for the Docker Official Library. It uses Go templating to dynamically set tags, Git references, and directory paths for different architectures. ```yaml Tags: {{ .tags }} GitFetch: refs/heads/{{ .version_major }} GitCommit: {{ .commit_hash }} amd64-Directory: {{ .image_type }}/amd64/ arm64v8-Directory: {{ .image_type }}/arm64/ ppc64le-Directory: {{ .image_type }}/ppc64le/ s390x-Directory: {{ .image_type }}/s390x/ Architectures: amd64, arm64v8, ppc64le, s390x ``` -------------------------------- ### Set AlmaLinux Minor Version Based on Major Version Source: https://github.com/almalinux/container-images/blob/main/README.md Dynamically set the AlmaLinux minor version based on the selected major version input. Use placeholders for specific minor versions. ```sh case ${{ inputs.version_major }} in 8) version_minor="<8_minor>" ;; 9) version_minor="<9_minor>" ;; 10) version_minor="<10_minor>" ;; ``` -------------------------------- ### Add and Commit Changes Source: https://github.com/almalinux/container-images/blob/main/README.md Commits and pushes changes to the repository, rewriting history and setting the upstream branch. ```yaml - name: Commit and push almalinux/container-images, branch '${version_major}' uses: EndBug/add-and-commit@v10 with: force: true branch: '${version_major}' set_upstream: true ``` -------------------------------- ### Set Latest AlmaLinux Version Variable Source: https://github.com/almalinux/container-images/blob/main/README.md Define the latest AlmaLinux major version to be used as a placeholder or default. ```yaml version_latest: ``` -------------------------------- ### Dockerfile for RootFS Extraction Source: https://github.com/almalinux/container-images/blob/main/README.md This Dockerfile is used to build an image from extracted RootFS blobs. It's part of the process to prepare the root file system for new container images. ```Dockerfile FROM scratch ADD rootfs.tar.gz / CMD ["/bin/bash"] ``` -------------------------------- ### Configure Image Types for Workflow Dispatch Source: https://github.com/almalinux/container-images/blob/main/README.md Add or modify inputs for specific image types when triggering the workflow dispatch in the build-test-push.yml file. ```yaml type_: description: '' required: true type: boolean ``` -------------------------------- ### Publish to Docker Official Library Workflow Source: https://github.com/almalinux/container-images/blob/main/README.md This GitHub Actions workflow is responsible for publishing container images to the Docker Official Library. It is triggered manually and requires a boolean input to confirm the publication. ```yaml name: Publish images to the Docker Library on: workflow_dispatch: inputs: pr: description: 'Publish to Docker Official Library' required: true type: boolean default: true ... ``` -------------------------------- ### Update Dockerfile for Official Library Build Source: https://github.com/almalinux/container-images/blob/main/README.md This Dockerfile snippet shows how to update the date stamp in a Dockerfile for official library builds. It ensures that Docker uses the latest pushed container image. ```dockerfile # Tags: 8-minimal, 8.9-minimal, 8.9-minimal-20240319 FROM scratch ADD almalinux-9-minimal-amd64.tar.xz / CMD ["/bin/bash"] ``` -------------------------------- ### Set Scheduled Workflow Cron Time Source: https://github.com/almalinux/container-images/blob/main/README.md Configure the schedule for the workflow to run at a specific time daily using Unix cron format. The default is 04:00 UTC. ```yaml schedule: # run every day at 04:00 UTC - cron: '00 04 * * *' ``` -------------------------------- ### Check for Important DNF Updates Source: https://github.com/almalinux/container-images/blob/main/README.md Checks for important security updates using dnf. The exit code determines if the build process should continue, especially for scheduled workflows. This command runs within a podman container. ```sh dnf check-update --secseverity=Important ``` -------------------------------- ### Commit Message for Dockerfile and RootFS Changes Source: https://github.com/almalinux/container-images/blob/main/README.md This is the commit message format used when pushing updated Dockerfiles and RootFS to the repository. It includes version, image type, build date, and a link to the GitHub Action run. ```yaml AlmaLinux ${version_major}-${images_type} image build as of ${date_stamp} (with ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}). ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.