Skip to content
Snippets Groups Projects
Commit 2d425f72 authored by Michael R. Crusoe's avatar Michael R. Crusoe :gay_pride_flag:
Browse files

SOURCE_DATE_EPOCH: Add R example

parent 4cbc0195
No related branches found
No related tags found
1 merge request!166docs: add R SOURCE_DATE_EPOCH example
Pipeline #802215 passed
......@@ -186,13 +186,13 @@ docker buildx build --output type=image,name=docker.io/username/image,push=true,
The `rewrite-timestamp` option is not set to `true` by default due to the overhead of rewriting image layers.
#### apt-get
##### apt-get
`RUN apt-get` does not automatically consume `SOURCE_DATE_EPOCH` to install packages from the past snapshot.
<https://github.com/reproducible-containers/repro-sources-list.sh> can be used for reconfiguring `/etc/apt/sources.list`
to use `https://snapshot.debian.org/archive/debian/<SOURCE_DATE_EPOCH>/`.
#### Further information
##### Further information
See:
- https://github.com/moby/buildkit/blob/master/docs/build-repro.md
- https://github.com/docker-library/official-images/issues/16044
......@@ -463,6 +463,16 @@ if (sourceDateEpoch != null) {
def extendedTimestamp = buildInstant.toString()
```
### R
```r
if (Sys.getenv("SOURCE_DATE_EPOCH") == "") {
current_date <- Sys.Date()
} else {
current_date <- as.Date(as.numeric(Sys.getenv("SOURCE_DATE_EPOCH")) / 86400, "1970-01-01")
}
```
### Last-resort using faketime
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment