Skip to content

Use text replacement to modify dockerfile once/day for windows#424

Merged
brawner merged 2 commits intomasterfrom
windows_invalidate_dockerfile
Apr 9, 2020
Merged

Use text replacement to modify dockerfile once/day for windows#424
brawner merged 2 commits intomasterfrom
windows_invalidate_dockerfile

Conversation

@brawner
Copy link
Contributor

@brawner brawner commented Apr 9, 2020

The previous approach of using a dockerfile ARG would not actually invalidate caches once-per-day as a --build-arg is apparently not part of the context.

This implements a solution similar to sed which is used with the linux dockerfile.

@brawner brawner self-assigned this Apr 9, 2020

# Invalidate once a day to cause online installers to check for updates
RUN echo %TODAYS_DATE%
RUN echo "@todays_date"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Becomes:

RUN echo "Thursday, April 9, 2020"

@brawner brawner merged commit cf82112 into master Apr 9, 2020
@delete-merged-branch delete-merged-branch bot deleted the windows_invalidate_dockerfile branch April 9, 2020 18:20
set DOCKERFILE=windows_docker_resources\Dockerfile.msvc%CI_VISUAL_STUDIO_VERSION%

rem "Change dockerfile once per day to invalidate docker caches"
powershell "(Get-Content ${Env:DOCKERFILE}).replace('@todays_date', $(Get-Date).ToLongDateString()) | Set-Content ${Env:DOCKERFILE}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I forgot that this would need to be escaped in order for empty to render the @-sign through: #426

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants