question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[core] Override default mounts for bundling containers

See original GitHub issue

I need a way to overwrite the mounting paths of the bundling containers which handle stuff like npm install on lambdas before packing and uploading. https://docs.aws.amazon.com/cdk/api/latest/docs/aws-lambda-readme.html#bundling-asset-code

It would be nice, if there would be an option to provide alternative paths for the mounted host paths.

Use Case

We use VScode for developing in CDK and want to use Devcontainers. With that we can use a preconfigured docker image as dev environment and a new developer doesn’t have to set up CLI and CDK etc. to start working.

It is possible to launch another docker image from inside the devcontainer. https://github.com/microsoft/vscode-dev-containers/tree/master/containers/docker-from-docker

This works, but the used mount paths are wrong. The CDK provides the paths from inside the devcontainer, but this docker-from-docker strategy requires host paths.

Proposed Solution

Extend the BundlingOptions in core (bundling.ts) with a function property, which allows editing which paths are used as default mounts paths for the bundling containers in asset-staging.ts (atm line 168-179).

    // Always mount input and output dir
    const volumes = [
      {
        hostPath: this.sourcePath,
        containerPath: AssetStaging.BUNDLING_INPUT_DIR,
      },
      {
        hostPath: bundleDir,
        containerPath: AssetStaging.BUNDLING_OUTPUT_DIR,
      },
      ...options.volumes ?? [],
    ];

Other

(I hope, I explained everything in enough detail, this is my first issue for such a big project as the AWS CDK)

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
rix0rrrcommented, Aug 25, 2020

I’m not opposed to LOCAL_WORKSPACE_FOLDER. But we would need to know which container path corresponds to the host’s LOCAL_WORKSPACE_FOLDER. Is that standardized?

On another note, why don’t you mount the directories at the same name in both host and container? This is what I generally do and it removes the need for the mapping.

This is what I put in my docker run:

    -v $HOME:$HOME -w $PWD

Which makes it so I can use any directory under ~, and I generally don’t need other directories anyway.

0reactions
github-actions[bot]commented, Jun 3, 2022

This issue has not received any attention in 1 year. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change default source code mount in containers
You can use the workspaceMount property in devcontainer.json to change the automatic mounting behavior. It expects the same value as the Docker CLI...
Read more >
Mount Propagation - Persistent Storage Examples
Mount propagation allows for sharing volumes mounted by a container to other containers in the same pod, or even to other pods on...
Read more >
Compose file version 3 reference
Override the default command. command: bundle exec thin -p 3000 ... This grants the container access to the config and mounts it at...
Read more >
3. Configuring Bundles - Robin Documentation
Compute resources such as memory, cpu, hugepages, gpu etc are allocated at the container level. Whilst specifying the number of cores needed, ...
Read more >
Module Federation
Control from consumer to container. Overriding modules is a one-directional operation. · Concept should be environment-independent. Usable in web, Node.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found