Skip to content

Commit a92dd78

Browse files
committed
Make image builds reproducible
1 parent 9aada81 commit a92dd78

File tree

9 files changed

+21
-18
lines changed

9 files changed

+21
-18
lines changed

.github/scripts/build-image.sh

+9-2
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,34 @@ echo "Building $IMAGE"
88
DEFAULT_GOLANG_VERSION="1.21"
99
DEFAULT_CHISEL_VERSION="v0.10.0"
1010

11-
RELEASE=$(./images/${IMAGE}/latest.sh)
11+
REPOSITORY=$(jq -r '.repository' ./images/${IMAGE}/metadata.json)
12+
RELEASE_METADATA=$(curl -s "https://api.github.com/repos/${REPOSITORY}/releases/latest")
13+
SOURCE_DATE_EPOCH=$(date +%s -d $(echo ${RELEASE_METADATA} | jq -r '.created_at'))
14+
RELEASE=$(echo ${RELEASE_METADATA} | jq -r '.tag_name')
1215
VERSION=${RELEASE%%_*}
1316
VERSION=${VERSION#release-}
1417
VERSION=${VERSION#v}
1518

19+
echo "Version $VERSION"
1620
if [[ -z $VERSION ]]; then
1721
echo "Failed to retrieve latest version for $IMAGE"
1822
else
1923
docker buildx build \
20-
--push \
2124
--platform linux/amd64,linux/arm64 \
25+
--provenance=false \
2226
--tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:${VERSION} \
2327
--tag ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:latest \
2428
--build-arg RELEASE=${RELEASE} \
2529
--build-arg VERSION=${VERSION} \
2630
--build-arg GOLANG_VERSION=${DEFAULT_GOLANG_VERSION} \
2731
--build-arg CHISEL_VERSION=${DEFAULT_CHISEL_VERSION} \
32+
--build-arg SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} \
2833
--label "org.opencontainers.image.authors=${GITHUB_REPOSITORY_OWNER}" \
2934
--label "org.opencontainers.image.source=${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}" \
3035
--label "org.opencontainers.image.version=${VERSION}" \
3136
--label "org.opencontainers.image.vendor=${GITHUB_REPOSITORY_OWNER}" \
3237
--label "org.opencontainers.image.title=${IMAGE}" \
38+
--output type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:${VERSION},rewrite-timestamp=true \
39+
--output type=registry,name=ghcr.io/${GITHUB_REPOSITORY_OWNER,,}/${IMAGE}:latest,rewrite-timestamp=true \
3340
- < images/${IMAGE}/Dockerfile
3441
fi

images/prowlarr/latest.sh

-4
This file was deleted.

images/prowlarr/metadata.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"repository": "Prowlarr/Prowlarr"
3+
}

images/qbittorrent/latest.sh

-4
This file was deleted.

images/qbittorrent/metadata.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"repository": "userdocs/qbittorrent-nox-static"
3+
}

images/radarr/latest.sh

-4
This file was deleted.

images/radarr/metadata.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"repository": "Radarr/Radarr"
3+
}

images/sonarr/latest.sh

-4
This file was deleted.

images/sonarr/metadata.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"repository": "Sonarr/Sonarr"
3+
}

0 commit comments

Comments
 (0)