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

AssetStaging: DockerVolume uses Bind Mount with BundlingFileAccess set to VOLUME_COPY #32805

Open
1 task
cgatt opened this issue Jan 9, 2025 · 1 comment · May be fixed by #32832
Open
1 task

AssetStaging: DockerVolume uses Bind Mount with BundlingFileAccess set to VOLUME_COPY #32805

cgatt opened this issue Jan 9, 2025 · 1 comment · May be fixed by #32832
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry bug This issue is a bug. effort/medium Medium work item – several days of effort p2

Comments

@cgatt
Copy link

cgatt commented Jan 9, 2025

Describe the bug

Setting bundling.bundlingFileAccess: BundlingFileAccess.VOLUME_COPY in AssetStaging still uses bind mounts for additional volumes created through bundling.volumes. The language in the docs does not make this explicitly clear, and leaves no good way to use additional volumes in envs where bind mounts are unavailable (e.g. DinD)

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

No response

Expected Behavior

When using BundlingFileAccess.VOLUME_COPY, I expect all volumes to use the volume copy behaviour

Current Behavior

Additional volumes use bind mounts regardless of bundlingFileAccess setting

Reproduction Steps

Use AssetStaging with BundlingFileAccess.VOLUME_COPY set and an additional volume mounted

const codeAsset = new AssetStaging(this, 'CodeAsset', {
  sourcePath: path.resolve('mule'),
  exclude: ['target/*', 'bin/*', '*.class', '*.jar'],
  bundling: {
    image: DockerImage.fromRegistry('public.ecr.aws/docker/library/alpine'),
    bundlingFileAccess: BundlingFileAccess.VOLUME_COPY,
    volumes: [{
      hostPath: '~/.m2',
      containerPath: '/root/.m2',
    }],
  },
});

Possible Solution

Rewrite the AssetStaging class to mount all volumes via the VOLUME_COPY mechanism instead of only the input and output. Alternately, extend DockerVolume as suggested in #20601 to allow each volume provided to choose its binding type (bind mount, volume copy, existing volume)

Additional Information/Context

No response

CDK CLI Version

2.174.0 (build 9604329)

Framework Version

No response

Node.js Version

v20.13.1

OS

Ubuntu

Language

TypeScript

Language Version

No response

Other information

No response

@cgatt cgatt added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jan 9, 2025
@github-actions github-actions bot added the @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry label Jan 9, 2025
@pahud pahud self-assigned this Jan 13, 2025
@pahud pahud added the investigating This issue is being investigated and/or work is in progress to resolve the issue. label Jan 13, 2025
@pahud
Copy link
Contributor

pahud commented Jan 13, 2025

Thank you for the report. This makes sense to me. We'll review your PR when it's ready.

@pahud pahud added p2 effort/medium Medium work item – several days of effort and removed investigating This issue is being investigated and/or work is in progress to resolve the issue. needs-triage This issue or PR still needs to be triaged. labels Jan 13, 2025
@pahud pahud removed their assignment Jan 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ecr Related to Amazon Elastic Container Registry bug This issue is a bug. effort/medium Medium work item – several days of effort p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants