cmd/containerbuild: set container build timestamp to the timestamp of the commit (#15)
Signed-off-by: Xe Iaso <me@xeiaso.net>
This commit is contained in:
parent
8cbe801c0c
commit
c81e938f63
2 changed files with 11 additions and 0 deletions
|
@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [Unreleased]
|
## [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
|
- The README now points to TecharoHQ/anubis instead of Xe/x
|
||||||
- Images are built using ko instead of `docker buildx build`
|
- Images are built using ko instead of `docker buildx build`
|
||||||
[#13](https://github.com/TecharoHQ/anubis/pull/13)
|
[#13](https://github.com/TecharoHQ/anubis/pull/13)
|
||||||
|
|
|
@ -30,14 +30,24 @@ func main() {
|
||||||
|
|
||||||
koDockerRepo := strings.TrimRight(*dockerRepo, "/"+filepath.Base(*dockerRepo))
|
koDockerRepo := strings.TrimRight(*dockerRepo, "/"+filepath.Base(*dockerRepo))
|
||||||
version, err := run("git describe --tags --always --dirty")
|
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(
|
slog.Debug(
|
||||||
"ko env",
|
"ko env",
|
||||||
"KO_DOCKER_REPO", koDockerRepo,
|
"KO_DOCKER_REPO", koDockerRepo,
|
||||||
|
"SOURCE_DATE_EPOCH", commitTimestamp,
|
||||||
"VERSION", version,
|
"VERSION", version,
|
||||||
)
|
)
|
||||||
|
|
||||||
os.Setenv("KO_DOCKER_REPO", koDockerRepo)
|
os.Setenv("KO_DOCKER_REPO", koDockerRepo)
|
||||||
|
os.Setenv("SOURCE_DATE_EPOCH", commitTimestamp)
|
||||||
os.Setenv("VERSION", version)
|
os.Setenv("VERSION", version)
|
||||||
|
|
||||||
setOutput("version", version)
|
setOutput("version", version)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue