Pass build date in build_args when building Dockerfile #6810
-
Hi! Couldn't find this anywhere but is it possible to pass build date in build_args when building a Dockerfile? Thanks! |
Beta Was this translation helpful? Give feedback.
Answered by
taylorsilva
Apr 1, 2021
Replies: 1 comment 3 replies
-
You'll need to have a task generate the date in the format you want. You could output the date into a file and then use Might look something like this: - task: generate-date
config:
...
outputs:
- name: todays
run:
path: sh
args:
- -cx
- |
date +'%Y%m%d' > todays/date
- load_var: date
file: todays/date
- task: build-image
config:
...
params:
ARG_DATE: ((.:date))
|
Beta Was this translation helpful? Give feedback.
3 replies
Answer selected by
ddhanak
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You'll need to have a task generate the date in the format you want. You could output the date into a file and then use
load_var
to read the file into a variable that you can then pass into your build step as a param using the var format((.:my-var))
Might look something like this: