Run Docker as current user in official builds
This commit is contained in:
parent
83ca9bf952
commit
5cb80c04ee
2 changed files with 16 additions and 6 deletions
|
@ -22,17 +22,18 @@
|
|||
"enabled": true,
|
||||
"continueOnError": false,
|
||||
"alwaysRun": false,
|
||||
"displayName": "Run docker",
|
||||
"displayName": "Run build in Docker container",
|
||||
"timeoutInMinutes": 0,
|
||||
"task": {
|
||||
"id": "d9bafed4-0b18-4f58-968d-86655b4d2ce9",
|
||||
"versionSpec": "1.*",
|
||||
"id": "6c731c3c-3c68-459a-a5c9-bde6e6595b5b",
|
||||
"versionSpec": "2.*",
|
||||
"definitionType": "task"
|
||||
},
|
||||
"inputs": {
|
||||
"filename": "docker",
|
||||
"arguments": "run -t --rm --sig-proxy=true --name $(Build.BuildId) -v $(Build.SourcesDirectory):/opt/code -w /opt/code -e CHANNEL -e CONNECTION_STRING -e REPO_ID -e REPO_USER -e REPO_PASS -e REPO_SERVER -e DOTNET_BUILD_SKIP_CROSSGEN -e PUBLISH_TO_AZURE_BLOB -e NUGET_FEED_URL -e NUGET_API_KEY -e GITHUB_PASSWORD -e ARTIFACT_STORAGE_KEY -e ARTIFACT_STORAGE_ACCOUNT -e ARTIFACT_STORAGE_CONTAINER -e CHECKSUM_STORAGE_KEY -e CHECKSUM_STORAGE_ACCOUNT -e CHECKSUM_STORAGE_CONTAINER chcosta/dotnetcore:rhel7_prereqs /bin/bash -c \"git clean -X -d -f; ./build.sh $(BuildArguments)\"",
|
||||
"workingFolder": "",
|
||||
"scriptPath": "scripts/dockerrun-as-current-user.sh",
|
||||
"args": "-t --rm --sig-proxy=true --name $(Build.BuildId) -v $(Build.SourcesDirectory):/opt/code -w /opt/code -e CHANNEL -e CONNECTION_STRING -e REPO_ID -e REPO_USER -e REPO_PASS -e REPO_SERVER -e DOTNET_BUILD_SKIP_CROSSGEN -e PUBLISH_TO_AZURE_BLOB -e NUGET_FEED_URL -e NUGET_API_KEY -e GITHUB_PASSWORD -e ARTIFACT_STORAGE_KEY -e ARTIFACT_STORAGE_ACCOUNT -e ARTIFACT_STORAGE_CONTAINER -e CHECKSUM_STORAGE_KEY -e CHECKSUM_STORAGE_ACCOUNT -e CHECKSUM_STORAGE_CONTAINER chcosta/dotnetcore:rhel7_prereqs /bin/bash -c \"HOME=/opt/code; git clean -X -d -f; ./build.sh $(BuildArguments)\"",
|
||||
"disableAutoCwd": "false",
|
||||
"cwd": "",
|
||||
"failOnStandardError": "false"
|
||||
}
|
||||
}
|
||||
|
|
9
scripts/dockerrun-as-current-user.sh
Normal file
9
scripts/dockerrun-as-current-user.sh
Normal file
|
@ -0,0 +1,9 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# Copyright (c) .NET Foundation and contributors. All rights reserved.
|
||||
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
||||
#
|
||||
|
||||
set -e
|
||||
|
||||
docker run -u="$(id -u):$(id -g)" "$@"
|
Loading…
Add table
Reference in a new issue