Skip to content

Commit

Permalink
Custom args for docker-build and docker-run tasks (microsoft#2294)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwateratmsft authored and Dmarch28 committed Mar 4, 2021
1 parent e9c5a48 commit b0cd987
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -1074,6 +1074,10 @@
"pull": {
"type": "boolean",
"description": "%vscode-docker.tasks.docker-build.dockerBuild.pull%"
},
"customOptions": {
"type": "string",
"description": "%vscode-docker.tasks.docker-build.dockerBuild.customOptions%"
}
}
},
Expand Down Expand Up @@ -1263,6 +1267,10 @@
"type": "boolean",
"description": "%vscode-docker.tasks.docker-run.dockerRun.remove%",
"default": false
},
"customOptions": {
"type": "string",
"description": "%vscode-docker.tasks.docker-run.dockerRun.customOptions%"
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
"vscode-docker.tasks.docker-build.dockerBuild.tag": "Tag applied to the Docker image used for debugging.",
"vscode-docker.tasks.docker-build.dockerBuild.target": "Docker build target (stage) used for debugging.",
"vscode-docker.tasks.docker-build.dockerBuild.pull": "Whether or not to pull new base images before building.",
"vscode-docker.tasks.docker-build.dockerBuild.customOptions": "Any other options to add to the `docker build` command.",
"vscode-docker.tasks.docker-build.platform": "The target platform for the application.",
"vscode-docker.tasks.docker-build.netCore.description": "Options for building .NET Core projects in Docker.",
"vscode-docker.tasks.docker-build.netCore.appProject": "The .NET Core project (.csproj, .fsproj, etc.) to build.",
Expand Down Expand Up @@ -80,6 +81,7 @@
"vscode-docker.tasks.docker-run.dockerRun.volumes.localPath": "Path on local machine that will be mapped. The folder will be created if it does not exist.",
"vscode-docker.tasks.docker-run.dockerRun.volumes.containerPath": "Path where the volume will be mapped within the container. The folder will be created if it does not exist.",
"vscode-docker.tasks.docker-run.dockerRun.volumes.permissions": "Permissions for the container for the mapped volume, `rw` for read-write or `ro` for read-only.",
"vscode-docker.tasks.docker-run.dockerRun.customOptions": "Any other options to add to the `docker run` command.",
"vscode-docker.tasks.docker-run.platform": "The target platform for the application.",
"vscode-docker.tasks.docker-run.netCore.description": "Options for running .NET Core projects in Docker.",
"vscode-docker.tasks.docker-run.netCore.appProject": "The .NET Core project (.csproj, .fsproj, etc.) to build.",
Expand Down
1 change: 1 addition & 0 deletions src/tasks/DockerBuildTaskDefinitionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export interface DockerBuildOptions {
tag?: string;
target?: string;
pull?: boolean;
customOptions?: string;
}

export interface DockerBuildTaskDefinitionBase extends TaskDefinitionBase {
Expand Down
1 change: 1 addition & 0 deletions src/tasks/DockerBuildTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ export class DockerBuildTaskProvider extends DockerTaskProvider {
.withKeyValueArgs('--label', getAggregateLabels(options.labels, defaultVsCodeLabels))
.withNamedArg('-t', options.tag)
.withNamedArg('--target', options.target)
.withArg(options.customOptions)
.withQuotedArg(options.context);
}
}
1 change: 1 addition & 0 deletions src/tasks/DockerRunTaskDefinitionBase.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export interface DockerRunOptions {
portsPublishAll?: boolean;
volumes?: DockerContainerVolume[];
remove?: boolean;
customOptions?: string;
}

export interface DockerRunTaskDefinitionBase extends TaskDefinitionBase {
Expand Down
1 change: 1 addition & 0 deletions src/tasks/DockerRunTaskProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ export class DockerRunTaskProvider extends DockerTaskProvider {
.withArrayArgs('--add-host', runOptions.extraHosts, extraHost => `${extraHost.hostname}:${extraHost.ip}`)
.withNamedArg('--entrypoint', runOptions.entrypoint)
.withFlagArg('--rm', runOptions.remove)
.withArg(runOptions.customOptions)
.withQuotedArg(runOptions.image)
.withArgs(runOptions.command);
}
Expand Down

0 comments on commit b0cd987

Please sign in to comment.