diff --git a/Dockerfile b/Dockerfile index 41ecab1..e205c9e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,6 +2,9 @@ FROM scratch LABEL org.opencontainers.image.authors="binhex" LABEL org.opencontainers.image.source="https://github.com/binhex/arch-base" +# release tag name from buildx arg +ARG RELEASETAG + # arch from buildx --platform, e.g. amd64 ARG TARGETARCH @@ -28,7 +31,7 @@ RUN ["/bootstrap/busybox", "--install", "-s", "/bootstrap"] # once the tarball is extracted we then use bash to execute the install script to # install everything else for the base image. # note, do not line wrap the below command, as it will fail looking for /bin/sh -RUN ["/bootstrap/sh", "-c", "/bootstrap/bootstrap.sh ${TARGETARCH}"] +RUN ["/bootstrap/sh", "-c", "/bootstrap/bootstrap.sh ${RELEASETAG} ${TARGETARCH}"] # env ##### diff --git a/build/common/root/bootstrap.sh b/build/common/root/bootstrap.sh index 0b32a0d..a6244d7 100755 --- a/build/common/root/bootstrap.sh +++ b/build/common/root/bootstrap.sh @@ -1,7 +1,10 @@ #!/bootstrap/sh +# get release tag name (defined in Dockerfile as arg) +RELEASETAG="${1}" + # get target arch from first parameter (defined in Dockerfile as arg) -TARGETARCH="${1}" +TARGETARCH="${2}" # create vars for arch if [ "${TARGETARCH}" = "amd64" ]; then diff --git a/build/common/root/install.sh b/build/common/root/install.sh index 2210ee2..c993528 100755 --- a/build/common/root/install.sh +++ b/build/common/root/install.sh @@ -3,14 +3,20 @@ # exit script if return code != 0 set -e +# release tag name from buildx arg, stripped of build ver using string manipulation +RELEASETAG="${1}" + # get target arch from first parameter (defined in Dockerfile as arg) -TARGETARCH="${1}" +TARGETARCH="${2}" # construct snapshot date (cannot use todays as archive wont exist) and set url for archive. # note: for arch linux arm archive repo that the snapshot date has to be at least 2 days # previous as the mirror from live to the archive for arm packages is slow snapshot_date=$(date -d "1 days ago" +%Y/%m/%d) +# write RELEASETAG to file to record the release tag used to build the image +echo "BASE_RELEASE_TAG=${RELEASETAG}" >> '/etc/image-release' + # now set pacman to use snapshot for packages for snapshot date if [[ "${TARGETARCH}" == "arm64" ]]; then echo 'Server = http://tardis.tiny-vps.com/aarm/repos/'"${snapshot_date}"'/$arch/$repo' > '/etc/pacman.d/mirrorlist'