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

(assets): Support fromTar for docker image assets #15419

Closed
1 of 2 tasks
pgarbe opened this issue Jul 5, 2021 · 3 comments · Fixed by #15438
Closed
1 of 2 tasks

(assets): Support fromTar for docker image assets #15419

pgarbe opened this issue Jul 5, 2021 · 3 comments · Fixed by #15438
Assignees
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. feature-request A feature should be added or improved. p1

Comments

@pgarbe
Copy link
Contributor

pgarbe commented Jul 5, 2021

It should be possible to add Docker images also from an existing tar file.

    const taskDefinition = new ecs.FargateTaskDefinition(this, 'TaskDef');
    taskDefinition.addContainer('DefaultContainer', {
      image: ecs.ContainerImage.fromTar('path/to/tarfile'),
      memoryLimitMiB: 512,
    });

Use Case

Some projects do not have a Dockerfile but use external tools to generate their images (e.g. jib). In that case, the image has to be uploaded manually to ECR and it's cumbersome to ensure that the stack has the correct reference (name / tag) But if it's handled as a regular container image asset CDK could do the heavy lifting.

Proposed Solution

Just an idea, needs to be validated:
Run docker load -i myTar.tar | sed "s/Loaded image: //g" as executable. This command returns the image name as required. Not sure yet, how to get the tar as asset from the synth to upload assets stage and how to deal with the hash (it should take over the hash of the tar file).

Other

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

This is a 🚀 Feature Request

@pgarbe pgarbe added feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged. labels Jul 5, 2021
@github-actions github-actions bot added the @aws-cdk/assets Related to the @aws-cdk/assets package label Jul 5, 2021
@peterwoodworth
Copy link
Contributor

Thanks for submitting a request and PR for this @pgarbe! Someone should be able to review the PR soon 😄

@peterwoodworth peterwoodworth added feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. p1 and removed needs-triage This issue or PR still needs to be triaged. labels Jul 6, 2021
@pgarbe
Copy link
Contributor Author

pgarbe commented Jul 6, 2021

Thanks. Still working on some tests, but looking forward to some feedback.

@mergify mergify bot closed this as completed in #15438 Jul 11, 2021
mergify bot pushed a commit that referenced this issue Jul 11, 2021
Allows to use an existing tarball for an container image. It loads the image from the tarball instead of building the image from a Dockerfile.

Fixes #15419 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

TikiTDO pushed a commit to TikiTDO/aws-cdk that referenced this issue Aug 3, 2021
Allows to use an existing tarball for an container image. It loads the image from the tarball instead of building the image from a Dockerfile.

Fixes aws#15419 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
hollanddd pushed a commit to hollanddd/aws-cdk that referenced this issue Aug 26, 2021
Allows to use an existing tarball for an container image. It loads the image from the tarball instead of building the image from a Dockerfile.

Fixes aws#15419 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package feature/enhancement A new API to make things easier or more intuitive. A catch-all for general feature requests. feature-request A feature should be added or improved. p1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants