Skip to content

Commit

Permalink
minor CR feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Elad Ben-Israel committed Jan 12, 2020
1 parent b86b5ef commit fdabd45
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions packages/@aws-cdk/cx-api/lib/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,11 @@ export interface ContainerImageAssetMetadataEntry extends BaseAssetMetadataEntry
* ECR Repository name and repo digest (separated by "@sha256:") where this
* image is stored.
*
* @default undefined If not specified, `repositoryName` and `imageTag` are required because
* otherwise how will the stack know where to find the asset, ha?
* @default undefined If not specified, `repositoryName` and `imageTag` are
* required because otherwise how will the stack know where to find the asset,
* ha?
* @deprecated specify `repositoryName` and `imageTag` instead, and then you
* know where the image will go.
*/
readonly imageNameParameter?: string;

Expand All @@ -98,8 +101,12 @@ export interface ContainerImageAssetMetadataEntry extends BaseAssetMetadataEntry
readonly repositoryName?: string;

/**
* The docker image tag to use for tagging pushed images.
* @default "latest"
* The docker image tag to use for tagging pushed images. This field is
* required if `imageParameterName` is ommited (otherwise, the app won't be
* able to find the image).
* @default - if this is omitted, the CLI will determine the image tag and
* pass it through the cloudformation parameter specified by
* `imageNameParameter`.
*/
readonly imageTag?: string;

Expand Down
8 changes: 4 additions & 4 deletions packages/aws-cdk/lib/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,22 @@ export async function prepareContainerAsset(assemblyDir: string,

const buildArgs = ([] as string[]).concat(...Object.entries(asset.buildArgs || {}).map(([k, v]) => ['--build-arg', `${k}=${v}`]));

const baseCommand = [
const buildCommand = [
'docker', 'build',
...buildArgs,
'--tag', imageUri,
contextPath
];

if (asset.target) {
baseCommand.push('--target', asset.target);
buildCommand.push('--target', asset.target);
}

if (asset.file) {
baseCommand.push('--file', asset.file);
buildCommand.push('--file', asset.file);
}

await shell(baseCommand);
await shell(buildCommand);

// Login and push
await dockerLogin(toolkitInfo);
Expand Down

0 comments on commit fdabd45

Please sign in to comment.