Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
"**/jszip/**",
"@aws-cdk/assets/minimatch",
"@aws-cdk/assets/minimatch/**",
"@aws-cdk/aws-ecr-assets/minimatch",
"@aws-cdk/aws-ecr-assets/minimatch/**",
"@aws-cdk/cx-api/semver",
"@aws-cdk/cx-api/semver/**",
"@aws-cdk/cx-api/semver/**",
Expand Down
12 changes: 12 additions & 0 deletions packages/@aws-cdk/aws-ecr-assets/lib/image-asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as assets from '@aws-cdk/assets';
import * as ecr from '@aws-cdk/aws-ecr';
import { Construct, Stack, Token } from '@aws-cdk/core';
import * as fs from 'fs';
import * as minimatch from 'minimatch';
import * as path from 'path';

export interface DockerImageAssetProps extends assets.FingerprintOptions {
Expand Down Expand Up @@ -95,6 +96,17 @@ export class DockerImageAsset extends Construct implements assets.IAsset {
exclude = [...exclude, ...fs.readFileSync(ignore).toString().split('\n').filter(e => !!e)];
}

// .dockerignore files allow you to ignore the Dockerfile and .dockerignore file
// so that these files do not get sent to the Daemon during COPY or ADD. The
// files are still utilized by the Docker daemon, even if they are ignored
// We need to copy these files into the asset folder, even if they
// are included in the .dockerignore, so that these files can be used during the
// docker build, so remove any excludes that would match these two essential files
exclude = exclude.filter(ignoreExpression => {
return !(minimatch('Dockerfile', ignoreExpression, { dot: true }) ||
minimatch('.dockerignore', ignoreExpression, { dot: true }));
});

if (props.repositoryName) {
this.node.addWarning(`DockerImageAsset.repositoryName is deprecated. Override "core.Stack.addDockerImageAsset" to control asset locations`);
}
Expand Down
8 changes: 6 additions & 2 deletions packages/@aws-cdk/aws-ecr-assets/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@
"@aws-cdk/aws-lambda": "1.22.0",
"@aws-cdk/aws-s3": "1.22.0",
"@aws-cdk/core": "1.22.0",
"@aws-cdk/cx-api": "1.22.0"
"@aws-cdk/cx-api": "1.22.0",
"minimatch": "^3.0.4"
},
"homepage": "https://github.com/aws/aws-cdk",
"peerDependencies": {
Expand All @@ -96,10 +97,13 @@
"engines": {
"node": ">= 10.3.0"
},
"bundledDependencies": [
"minimatch"
],
"stability": "experimental",
"awslint": {
"exclude": [
"docs-public-apis:@aws-cdk/aws-ecr-assets.DockerImageAssetProps"
]
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
foobar.txt
Dockerfile
.dockerignore