-
Notifications
You must be signed in to change notification settings - Fork 4k
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
Customize asset bundling execution #8460
Comments
@jogold what do you think? |
Do you expect |
The idea is not to replace |
OK got it! The naive approach is to skip |
They will just tailor their shim based on the use case. For example, they can explore the source of the docker image in Docker Hub and install those dependencies in their environments. Case by case. |
@jogold I am going to make this change. I'll send a PR for a review. |
In order to support environments in which docker cannot be executed or has a unique location, we added an environment variable `CDK_DOCKER` which is used instead of `docker` if defined. Resolves #8460
In order to support environments in which docker cannot be executed or has a unique location, we added an environment variable `CDK_DOCKER` which is used instead of `docker` if defined. Resolves #8460 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
We should offer a way for users to customize how docker is executed during asset bundling at the app level in order to allow users that can’t use docker to leverage bundling.
Use Case
Asset bundling relies on docker to offer a ubiquitous experience for library consumers (see “why we use docker” below). However, running docker in some environments is a major barrier or even not allowed.
As an escape hatch, we should allow users at the application level to override the way docker is executed so they can still use asset bundling in their systems.
Proposed Solution
Introduce some inversion of control when executing the various docker commands during bundling.
This is something that should be done (only?) at the app level since it’s about the specific synthesis environment and it should not be possible for libraries to override this behavior given their don’t know what the synthesis environment will be.
I wonder if it is sufficient to simply say “docker is in PATH and you are welcome to simply provide your own docker command that does whatever you want as long as it respects the contract.”
Another alternative is to defer to an environment variable such as
CDK_DOCKER
if it is defined.Why we use Docker?
Consider the use case in which an app consumes a third-party library which leverages asset bundling (like NodeJsFunction) under the hood (or even multi-level deep).
This app doesn’t even know that somewhere in their dependency graph, someone wants to bundle a Nodejs library with Parcel, let alone interested in setting up their dev and build environments to include these tools.
Docker offers a way to abstract this completely. Granted - this app will need docker available during synthesis, which I could be a barrier in some environments, but once they have docker, they can use any construct library.
This is a 🚀 Feature Request
The text was updated successfully, but these errors were encountered: