Skip to content

Commit

Permalink
put in release tag recording
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jul 22, 2024
1 parent 02e4282 commit 7219de4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
#####
Expand Down
5 changes: 4 additions & 1 deletion build/common/root/bootstrap.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
8 changes: 7 additions & 1 deletion build/common/root/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down

0 comments on commit 7219de4

Please sign in to comment.