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

[ecr] DockerImageAsset is not optimal - always pushs existing image to ECR #5069

Closed
zxkane opened this issue Nov 17, 2019 · 1 comment
Closed
Assignees
Labels
@aws-cdk/assets Related to the @aws-cdk/assets package @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.

Comments

@zxkane
Copy link
Contributor

zxkane commented Nov 17, 2019

DockerImageAsset always tries to push the built image to ECR even if no Dockerfile and image layer changes.

Reproduction Steps

Create a ECR repo via DockerImageAsset

const computeImage = new DockerImageAsset(this, 'ComputeImage', {
            directory: path.join(__dirname, '../assets/compute-task')
        });

Dockerfile

FROM python:3.7-alpine

ADD compute.py /app/compute.py

RUN pip install boto3==1.10.* 

Error Log

console log

Sending build context to Docker daemon 3.584kB
Step 1/3 : FROM python:3.7-alpine
---> 8922d588eec6
Step 2/3 : ADD compute.py /app/compute.py
---> Using cache
---> 605abcbbeadf
Step 3/3 : RUN pip install boto3==1.10.*
---> Using cache
---> c2ab563a903c
Successfully built c2ab563a903c
Successfully tagged 034068960621.dkr.ecr.cn-northwest-1.amazonaws.com.cn/cdk/surfingcomputestatckcomputeimage4b6d3c06:latest
WARNING! Using --password via the CLI is insecure. Use --password-stdin.
Login Succeeded
⌛ Pushing Docker image for cdk.out/asset.91f12123bfdb27cb0ac437167dbea43d2cca31c038944cbd3e557dc2ed52d2e9; this may take a while.
The push refers to repository [034068960621.dkr.ecr.cn-northwest-1.amazonaws.com.cn/cdk/surfingcomputestatckcomputeimage4b6d3c06]
db68905d2f2d: Preparing
4bab69c9387c: Preparing
623223ad637d: Preparing
7b07cfe9774a: Preparing
d376bf36dcd6: Preparing
dcd185b843c6: Preparing
77cae8ab23bf: Preparing
dcd185b843c6: Waiting
77cae8ab23bf: Waiting
d376bf36dcd6: Layer already exists
7b07cfe9774a: Layer already exists
db68905d2f2d: Layer already exists
4bab69c9387c: Layer already exists
623223ad637d: Layer already exists
77cae8ab23bf: Layer already exists
dcd185b843c6: Layer already exists
latest: digest: sha256:5acec7d6726ab11318abed3b9f42357b0f7e97a74490cf91b6e8d59b855c391e size: 1787
034068960621.dkr.ecr.cn-northwest-1.amazonaws.com.cn/cdk/surfingcomputestatckcomputeimage4b6d3c06@sha256:5acec7d6726ab11318abed3b9f42357b0f7e97a74490cf91b6e8d59b855c391e|

Environment

  • CLI Version : 1.16.3
  • Framework Version:
  • OS : Macos X 10.15
  • Language : Typescript

Other


This is 🐛 Bug Report

@zxkane zxkane added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 17, 2019
@SomayaB SomayaB added @aws-cdk/assets Related to the @aws-cdk/assets package @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry labels Nov 18, 2019
@eladb eladb added feature-request A feature should be added or improved. and removed bug This issue is a bug. labels Nov 20, 2019
@eladb eladb changed the title [ecr] DockerImageAsset always pushs existing image to ECR [ecr] DockerImageAsset is not optimal - always pushs existing image to ECR Nov 20, 2019
@eladb
Copy link
Contributor

eladb commented Jan 23, 2020

This has been improved in #5733

@eladb eladb closed this as completed Jan 23, 2020
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 @aws-cdk/aws-ecr Related to Amazon Elastic Container Registry feature-request A feature should be added or improved. needs-triage This issue or PR still needs to be triaged.
Projects
None yet
Development

No branches or pull requests

3 participants