aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md1
-rw-r--r--cmd/containerbuild/main.go10
2 files changed, 11 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5089d54..6964f51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
+- Docker images are now built with the timestamp set to the commit timestamp
- The README now points to TecharoHQ/anubis instead of Xe/x
- Images are built using ko instead of `docker buildx build`
[#13](https://github.com/TecharoHQ/anubis/pull/13)
diff --git a/cmd/containerbuild/main.go b/cmd/containerbuild/main.go
index 4eeae4c..e99dee5 100644
--- a/cmd/containerbuild/main.go
+++ b/cmd/containerbuild/main.go
@@ -30,14 +30,24 @@ func main() {
koDockerRepo := strings.TrimRight(*dockerRepo, "/"+filepath.Base(*dockerRepo))
version, err := run("git describe --tags --always --dirty")
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ commitTimestamp, err := run("git log -1 --format='%ct'")
+ if err != nil {
+ log.Fatal(err)
+ }
slog.Debug(
"ko env",
"KO_DOCKER_REPO", koDockerRepo,
+ "SOURCE_DATE_EPOCH", commitTimestamp,
"VERSION", version,
)
os.Setenv("KO_DOCKER_REPO", koDockerRepo)
+ os.Setenv("SOURCE_DATE_EPOCH", commitTimestamp)
os.Setenv("VERSION", version)
setOutput("version", version)