Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ COPY system_files /system_files/

FROM quay.io/fedora/fedora-bootc:44
ARG ARMADA_VERSION=unknown
ARG ARMADA_FEDORA_MIRROR=
LABEL org.opencontainers.image.version="${ARMADA_VERSION}"

RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
Expand All @@ -66,6 +67,7 @@ RUN --mount=type=bind,from=ctx,source=/,target=/ctx \
--mount=type=tmpfs,dst=/tmp \
mkdir -p /usr/lib/armada && \
printf '%s\n' "${ARMADA_VERSION}" >/usr/lib/armada/version && \
export ARMADA_FEDORA_MIRROR="${ARMADA_FEDORA_MIRROR}" && \
/ctx/build_files/build.sh

RUN bootc container lint
3 changes: 3 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ build $target_image=image_name $tag=default_tag:
BUILD_ARGS=()
ARMADA_VERSION="$(TZ=America/New_York date +%Y%m%d).$(git rev-parse --short HEAD)"
BUILD_ARGS+=("--build-arg" "ARMADA_VERSION=${ARMADA_VERSION}")
if [[ -n "${ARMADA_FEDORA_MIRROR:-}" ]]; then
BUILD_ARGS+=("--build-arg" "ARMADA_FEDORA_MIRROR=${ARMADA_FEDORA_MIRROR}")
fi

# Allow local armada-packages images to override pinned package images.
mapfile -t PKG_VARS < <(sed -n 's/^ARG \([A-Z0-9_]*_PKG\)=.*/\1/p' Containerfile)
Expand Down
28 changes: 28 additions & 0 deletions build_files/05-configure-dnf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
set -euxo pipefail

BUILD_DNF_STATE_DIR=/tmp/armada-build-dnf

mkdir -p /etc/dnf/libdnf5.conf.d
cat >/etc/dnf/libdnf5.conf.d/10-armada-build.conf <<'EOF'
[main]
fastestmirror=True
max_parallel_downloads=10
minrate=200k
timeout=20
EOF

if [[ -n "${ARMADA_FEDORA_MIRROR:-}" ]]; then
fedora_mirror="${ARMADA_FEDORA_MIRROR%/}"
mkdir -p "${BUILD_DNF_STATE_DIR}/yum.repos.d"

for repo in /etc/yum.repos.d/fedora*.repo; do
[[ -e "${repo}" ]] || continue
grep -q '^#baseurl=http://download.example/pub/fedora/linux' "${repo}" || continue
cp -a "${repo}" "${BUILD_DNF_STATE_DIR}/yum.repos.d/${repo##*/}"
sed -i \
-e 's|^metalink=|#metalink=|' \
-e "s|^#baseurl=http://download.example/pub/fedora/linux|baseurl=${fedora_mirror}|" \
"${repo}"
done
fi
15 changes: 15 additions & 0 deletions build_files/75-restore-build-dnf.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash
set -euxo pipefail

BUILD_DNF_STATE_DIR=/tmp/armada-build-dnf

rm -f /etc/dnf/libdnf5.conf.d/10-armada-build.conf

if [[ -d "${BUILD_DNF_STATE_DIR}/yum.repos.d" ]]; then
for repo in "${BUILD_DNF_STATE_DIR}"/yum.repos.d/*.repo; do
[[ -e "${repo}" ]] || continue
cp -a "${repo}" "/etc/yum.repos.d/${repo##*/}"
done
fi

rm -rf "${BUILD_DNF_STATE_DIR}"
2 changes: 2 additions & 0 deletions build_files/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -euxo pipefail

cd /ctx/build_files

./05-configure-dnf.sh
./10-base-packages.sh
./20-install-kernel.sh
./30-install-steam-session.sh
Expand All @@ -12,4 +13,5 @@ cd /ctx/build_files
./55-generate-initramfs.sh
./60-set-default-target.sh
./70-cleanup.sh
./75-restore-build-dnf.sh
./80-finalize-update-state.sh