Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/multistage #16

Merged
merged 17 commits into from
Nov 28, 2023
Merged

Feature/multistage #16

merged 17 commits into from
Nov 28, 2023

Conversation

AlexAxthelm
Copy link
Contributor

@AlexAxthelm AlexAxthelm commented Nov 17, 2023

use buildx --no-cache-filter with multistage builds to not cache the installation of PACTA packages, but keep the cache for everything else (like system deps)

Depends on #14 as base for dockerfile to split into stages.
Depends on #15 to ignore .git and .github directories
Depends on #12 to use docker buildx

using https://github.com/docker/build-push-action/
which enables multi-architecture builds and pushing to multiple
registries, as well as other features available in buildx (such as
build-time secrets)
merging `R` related RUN commands
resolves hadolint 3059: https://github.com/hadolint/hadolint/wiki/DL3059
Hard code system dependencies into Dockerfile to avoid changing during
build process.
It is better to install them ourselves so we know what is being included
Adding:

* libicu-dev (needed by `stringi`)
* `pandoc` (needed by `knitr` & `rmarkdown`)
reduce build context by ignoring anything that isn't actually used in
the docker image
Using build stages, so the we can use `buildx`'s `no-cache-filters` to
force fetching of the latest versions of the pacta packages
Copy link

github-actions bot commented Nov 17, 2023

Docker image from this PR (a3af78e) created

docker pull ghcr.io/rmi-pacta/workflow.pacta:pr16

@AlexAxthelm
Copy link
Contributor Author

@cjyetman Keeping this as draft until/if the prereqs are merged in, but you can see the proof of concept in the build logs:

Using Multistage build with no-cache-filter: (look for where it stops saying "extracting")
Installing all the System Dependencies: Logs
Leveraging the build cache, but still actually running the pak::pak() command: Logs

Compare to just using buildx, with GitHub actions cache, and no stage filter:
First run: Logs
Second run (pulled from cache): Logs

Dockerfile Show resolved Hide resolved
@AlexAxthelm AlexAxthelm marked this pull request as ready for review November 17, 2023 12:20
@AlexAxthelm AlexAxthelm requested a review from cjyetman November 17, 2023 12:21
@AlexAxthelm AlexAxthelm merged commit bffe748 into main Nov 28, 2023
4 checks passed
@AlexAxthelm AlexAxthelm deleted the feature/multistage branch November 28, 2023 11:20
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.

2 participants