@devcontainers/cli
Advanced tools
Comparing version 0.6.0 to 0.7.0
@@ -5,2 +5,9 @@ # Change Log | ||
## June 2022 | ||
### [0.7.0] | ||
- Multi-platform build support. (https://github.com/devcontainers/cli/pull/24) | ||
- User-scoped tmp folder on Linux. (https://github.com/microsoft/vscode-remote-release/issues/2347) | ||
## May 2022 | ||
@@ -7,0 +14,0 @@ |
{ | ||
"variants": ["3.15", "3.14", "3.13"], | ||
"definitionVersion": "0.204.3", | ||
"definitionVersion": "0.204.4", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": false, |
{ | ||
"definitionVersion": "2.0.2", | ||
"definitionVersion": "2.0.3", | ||
"build": { | ||
@@ -4,0 +4,0 @@ "latest": true, |
{ | ||
"variants": ["bullseye", "buster", "jammy", "focal", "bionic"], | ||
"definitionVersion": "0.205.0", | ||
"definitionVersion": "0.205.1", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "bullseye", |
{ | ||
"variants": ["buster", "bullseye", "stretch"], | ||
"definitionVersion": "0.202.6", | ||
"definitionVersion": "0.202.7", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "bullseye", |
{ | ||
"variants": ["6.0-bullseye-slim", "6.0-focal", "3.1-bullseye", "3.1-focal"], | ||
"definitionVersion": "0.203.1", | ||
"definitionVersion": "0.203.2", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "6.0-bullseye-slim", |
{ | ||
"variants": ["1.18-bullseye", "1.18-buster", "1.17-bullseye", "1.17-buster"], | ||
"definitionVersion": "0.206.1", | ||
"definitionVersion": "0.206.2", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "1.18-bullseye", |
{ | ||
"variants": [ "17-bullseye", "17-buster", "11-bullseye", "11-buster" ], | ||
"definitionVersion": "0.205.3", | ||
"definitionVersion": "0.205.4", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "17-bullseye", |
{ | ||
"variants": ["18-bullseye", "16-bullseye", "14-bullseye", "18-buster", "16-buster", "14-buster"], | ||
"definitionVersion": "0.204.0", | ||
"definitionVersion": "0.204.1", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "18-bullseye", |
{ | ||
"variants": ["8.1-apache-bullseye", "8.0-apache-bullseye", "7.4-apache-bullseye", "8.1-apache-buster", "8.0-apache-buster", "7.4-apache-buster" ], | ||
"definitionVersion": "0.203.3", | ||
"definitionVersion": "0.203.4", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "8.1-apache-bullseye", |
{ | ||
"definitionVersion": "0.202.6", | ||
"definitionVersion": "0.202.7", | ||
"build": { | ||
@@ -4,0 +4,0 @@ "latest": true, |
{ | ||
"definitionVersion": "0.202.3", | ||
"definitionVersion": "0.202.4", | ||
"build": { | ||
@@ -4,0 +4,0 @@ "latest": true, |
{ | ||
"variants": ["3.1-bullseye", "3.0-bullseye", "2.7-bullseye", "3.1-buster", "3.0-buster", "2.7-buster"], | ||
"definitionVersion": "0.203.3", | ||
"definitionVersion": "0.203.4", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "3.1-bullseye", |
{ | ||
"variants": ["buster", "bullseye"], | ||
"definitionVersion": "0.202.0", | ||
"definitionVersion": "0.202.1", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "bullseye", |
{ | ||
"variants": ["18-bullseye", "16-bullseye", "14-bullseye", "18-buster", "16-buster", "14-buster"], | ||
"definitionVersion": "0.204.0", | ||
"definitionVersion": "0.204.1", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": "16-buster", |
{ | ||
"variants": ["jammy", "focal", "bionic"], | ||
"definitionVersion": "0.203.0", | ||
"definitionVersion": "0.203.1", | ||
"build": { | ||
@@ -5,0 +5,0 @@ "latest": false, |
{ | ||
"name": "vscode-dev-containers", | ||
"version": "0.238.1", | ||
"version": "0.241.1", | ||
"description": "VS Code Dev Containers: Definitions and Templates", | ||
@@ -5,0 +5,0 @@ "repository": { |
@@ -25,2 +25,3 @@ /// <reference types="node" /> | ||
readDirWithTypes?(dirpath: string): Promise<[string, FileTypeBitmask][]>; | ||
getUsername(): Promise<string>; | ||
getuid(): Promise<number>; | ||
@@ -27,0 +28,0 @@ getgid(): Promise<number>; |
@@ -67,2 +67,3 @@ "use strict"; | ||
readDir: pfs_1.readLocalDir, | ||
getUsername: async () => os.userInfo().username, | ||
getuid: async () => process.getuid(), | ||
@@ -69,0 +70,0 @@ getgid: async () => process.getgid(), |
@@ -44,2 +44,4 @@ /// <reference types="node" /> | ||
remoteEnv: Record<string, string>; | ||
buildxPlatform: string | undefined; | ||
buildxPush: boolean; | ||
} | ||
@@ -46,0 +48,0 @@ export interface PostCreate { |
@@ -331,3 +331,3 @@ "use strict"; | ||
const version = common.package.version; | ||
const destDockerfile = cliHost.path.join(await cliHost.tmpdir(), 'vsch', `${dockerfileName}-${version}`); | ||
const destDockerfile = cliHost.path.join(await (0, utils_1.getCacheFolder)(cliHost), `${dockerfileName}-${version}`); | ||
const tmpDockerfile = `${destDockerfile}-${Date.now()}`; | ||
@@ -334,0 +334,0 @@ await cliHost.mkdirp(cliHost.path.dirname(tmpDockerfile)); |
@@ -35,2 +35,4 @@ import { DockerResolverParameters, UpdateRemoteUserUIDDefault, BindMountConsistency } from './utils'; | ||
useBuildKit: 'auto' | 'never'; | ||
buildxPlatform: string | undefined; | ||
buildxPush: boolean; | ||
} | ||
@@ -37,0 +39,0 @@ export declare function launch(options: ProvisionOptions, disposables: (() => Promise<unknown> | undefined)[]): Promise<{ |
@@ -101,2 +101,4 @@ "use strict"; | ||
remoteEnv, | ||
buildxPlatform: options.buildxPlatform, | ||
buildxPush: options.buildxPush, | ||
}; | ||
@@ -136,2 +138,4 @@ const dockerPath = options.dockerPath || 'docker'; | ||
isTTY: process.stdin.isTTY || options.logFormat === 'json', | ||
buildxPlatform: common.buildxPlatform, | ||
buildxPush: common.buildxPush, | ||
}; | ||
@@ -138,0 +142,0 @@ } |
@@ -167,2 +167,4 @@ "use strict"; | ||
useBuildKit: buildkit, | ||
buildxPlatform: undefined, | ||
buildxPush: false, | ||
}; | ||
@@ -221,2 +223,4 @@ const result = await doProvision(options); | ||
'buildkit': { choices: ['auto', 'never'], default: 'auto', description: 'Control whether BuildKit should be used' }, | ||
'platform': { type: 'string', description: 'Set target platforms.' }, | ||
'push': { type: 'boolean', default: false, description: 'Push to a container registry.' }, | ||
}); | ||
@@ -234,3 +238,3 @@ } | ||
} | ||
async function doBuild({ 'user-data-folder': persistedFolder, 'docker-path': dockerPath, 'docker-compose-path': dockerComposePath, 'workspace-folder': workspaceFolderArg, 'log-level': logLevel, 'log-format': logFormat, 'no-cache': buildNoCache, 'image-name': argImageName, 'cache-from': addCacheFrom, 'buildkit': buildkit, }) { | ||
async function doBuild({ 'user-data-folder': persistedFolder, 'docker-path': dockerPath, 'docker-compose-path': dockerComposePath, 'workspace-folder': workspaceFolderArg, 'log-level': logLevel, 'log-format': logFormat, 'no-cache': buildNoCache, 'image-name': argImageName, 'cache-from': addCacheFrom, 'buildkit': buildkit, 'platform': buildxPlatform, 'push': buildxPush, }) { | ||
const disposables = []; | ||
@@ -271,3 +275,5 @@ const dispose = async () => { | ||
additionalCacheFroms: addCacheFroms, | ||
useBuildKit: buildkit | ||
useBuildKit: buildkit, | ||
buildxPlatform, | ||
buildxPush, | ||
}, disposables); | ||
@@ -289,5 +295,7 @@ const { common, dockerCLI, dockerComposeCLI } = params; | ||
// Build the base image and extend with features etc. | ||
const { updatedImageName } = await (0, singleContainer_1.buildNamedImageAndExtend)(params, config); | ||
const { updatedImageName } = await (0, singleContainer_1.buildNamedImageAndExtend)(params, config, argImageName); | ||
if (argImageName) { | ||
await (0, dockerUtils_1.dockerPtyCLI)(params, 'tag', updatedImageName, argImageName); | ||
if (!buildxPush) { | ||
await (0, dockerUtils_1.dockerPtyCLI)(params, 'tag', updatedImageName, argImageName); | ||
} | ||
imageNameResult = argImageName; | ||
@@ -300,2 +308,5 @@ } | ||
else if ('dockerComposeFile' in config) { | ||
if (buildxPlatform || buildxPush) { | ||
throw new errors_1.ContainerError({ description: '--platform or --push not supported.' }); | ||
} | ||
const cwdEnvFile = cliHost.path.join(cliHost.cwd, '.env'); | ||
@@ -331,2 +342,5 @@ const envFile = Array.isArray(config.dockerComposeFile) && config.dockerComposeFile.length === 0 && await cliHost.isFile(cwdEnvFile) ? cwdEnvFile : undefined; | ||
const { updatedImageName } = await (0, containerFeatures_1.extendImage)(params, config, config.image, 'image' in config); | ||
if (buildxPlatform || buildxPush) { | ||
throw new errors_1.ContainerError({ description: '--platform or --push require dockerfilePath.' }); | ||
} | ||
if (argImageName) { | ||
@@ -445,3 +459,5 @@ await (0, dockerUtils_1.dockerPtyCLI)(params, 'tag', updatedImageName, argImageName); | ||
additionalCacheFroms: [], | ||
useBuildKit: 'auto' | ||
useBuildKit: 'auto', | ||
buildxPlatform: undefined, | ||
buildxPush: false, | ||
}, disposables); | ||
@@ -650,3 +666,5 @@ const { common } = params; | ||
additionalCacheFroms: [], | ||
useBuildKit: 'auto' | ||
useBuildKit: 'auto', | ||
buildxPlatform: undefined, | ||
buildxPush: false, | ||
}, disposables); | ||
@@ -653,0 +671,0 @@ const { common } = params; |
@@ -8,3 +8,3 @@ import { ResolverResult, DockerResolverParameters, WorkspaceConfiguration } from './utils'; | ||
export declare function openDockerfileDevContainer(params: DockerResolverParameters, config: DevContainerFromDockerfileConfig | DevContainerFromImageConfig, workspaceConfig: WorkspaceConfiguration, idLabels: string[]): Promise<ResolverResult>; | ||
export declare function buildNamedImageAndExtend(params: DockerResolverParameters, config: DevContainerFromDockerfileConfig | DevContainerFromImageConfig): Promise<{ | ||
export declare function buildNamedImageAndExtend(params: DockerResolverParameters, config: DevContainerFromDockerfileConfig | DevContainerFromImageConfig, argImageName?: string): Promise<{ | ||
updatedImageName: string; | ||
@@ -11,0 +11,0 @@ collapsedFeaturesConfig: CollapsedFeaturesConfig | undefined; |
@@ -92,5 +92,8 @@ "use strict"; | ||
} | ||
async function buildNamedImageAndExtend(params, config) { | ||
function getDefaultName(config, params) { | ||
return 'image' in config ? config.image : (0, utils_1.getFolderImageName)(params.common); | ||
} | ||
async function buildNamedImageAndExtend(params, config, argImageName) { | ||
var _a; | ||
const imageName = 'image' in config ? config.image : (0, utils_1.getFolderImageName)(params.common); | ||
const imageName = argImageName !== null && argImageName !== void 0 ? argImageName : getDefaultName(config, params); | ||
params.common.progress(injectHeadless_1.ResolverProgress.BuildingImage); | ||
@@ -150,5 +153,18 @@ if ((0, utils_1.isDockerFileConfig)(config)) { | ||
const args = []; | ||
if (!buildParams.buildKitVersion && | ||
(buildParams.buildxPlatform || buildParams.buildxPush)) { | ||
throw new errors_1.ContainerError({ description: '--platform or --push require BuildKit enabled.', data: { fileWithError: dockerfilePath } }); | ||
} | ||
if (buildParams.buildKitVersion) { | ||
args.push('buildx', 'build', '--load', // (short for --output=docker, i.e. load into normal 'docker images' collection) | ||
'--build-arg', 'BUILDKIT_INLINE_CACHE=1'); | ||
args.push('buildx', 'build'); | ||
if (buildParams.buildxPlatform) { | ||
args.push('--platform', buildParams.buildxPlatform); | ||
} | ||
if (buildParams.buildxPush) { | ||
args.push('--push'); | ||
} | ||
else { | ||
args.push('--load'); // (short for --output=docker, i.e. load into normal 'docker images' collection) | ||
} | ||
args.push('--build-arg', 'BUILDKIT_INLINE_CACHE=1'); | ||
} | ||
@@ -155,0 +171,0 @@ else { |
@@ -40,2 +40,4 @@ /// <reference types="node" /> | ||
isTTY: boolean; | ||
buildxPlatform: string | undefined; | ||
buildxPush: boolean; | ||
} | ||
@@ -99,2 +101,4 @@ export interface ResolverResult { | ||
}): Promise<string>; | ||
export declare function getCacheFolder(cliHost: CLIHost): Promise<string>; | ||
export declare function getLocalCacheFolder(): string; | ||
export declare function ensureDockerfileHasFinalStageName(dockerfile: string, defaultLastStageName: string): { | ||
@@ -101,0 +105,0 @@ lastStageName: string; |
@@ -26,5 +26,6 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ensureDockerfileHasFinalStageName = exports.createFeaturesTempFolder = exports.getFolderHash = exports.getFolderImageName = exports.runUserCommand = exports.createContainerProperties = exports.getDockerContextPath = exports.getTunnelInformation = exports.getWorkspaceConfiguration = exports.getHostMountFolder = exports.isDevContainerAuthority = exports.inspectDockerImage = exports.startEventSeen = exports.uriToWSLFsPath = exports.getPackageConfig = exports.RemoteDocuments = exports.fileDocuments = exports.createDocuments = exports.CLIHostDocuments = exports.parentURI = exports.uriToFsPath = exports.resolveConfigFilePath = exports.isDockerFileConfig = exports.getDockerfilePath = exports.getConfigFilePath = void 0; | ||
exports.ensureDockerfileHasFinalStageName = exports.getLocalCacheFolder = exports.getCacheFolder = exports.createFeaturesTempFolder = exports.getFolderHash = exports.getFolderImageName = exports.runUserCommand = exports.createContainerProperties = exports.getDockerContextPath = exports.getTunnelInformation = exports.getWorkspaceConfiguration = exports.getHostMountFolder = exports.isDevContainerAuthority = exports.inspectDockerImage = exports.startEventSeen = exports.uriToWSLFsPath = exports.getPackageConfig = exports.RemoteDocuments = exports.fileDocuments = exports.createDocuments = exports.CLIHostDocuments = exports.parentURI = exports.uriToFsPath = exports.resolveConfigFilePath = exports.isDockerFileConfig = exports.getDockerfilePath = exports.getConfigFilePath = void 0; | ||
const path = __importStar(require("path")); | ||
const crypto = __importStar(require("crypto")); | ||
const os = __importStar(require("os")); | ||
const errors_1 = require("../spec-common/errors"); | ||
@@ -297,3 +298,3 @@ const commonUtils_1 = require("../spec-common/commonUtils"); | ||
// Create temp folder | ||
const tmpFolder = cliHost.path.join(await cliHost.tmpdir(), 'vsch', 'container-features', `${version}-${Date.now()}`); | ||
const tmpFolder = cliHost.path.join(await getCacheFolder(cliHost), 'container-features', `${version}-${Date.now()}`); | ||
await cliHost.mkdirp(tmpFolder); | ||
@@ -303,2 +304,10 @@ return tmpFolder; | ||
exports.createFeaturesTempFolder = createFeaturesTempFolder; | ||
async function getCacheFolder(cliHost) { | ||
return cliHost.path.join(await cliHost.tmpdir(), cliHost.platform === 'linux' ? `vsch-${await cliHost.getUsername()}` : 'vsch'); | ||
} | ||
exports.getCacheFolder = getCacheFolder; | ||
function getLocalCacheFolder() { | ||
return path.join(os.tmpdir(), process.platform === 'linux' ? `vsch-${os.userInfo().username}` : 'vsch'); | ||
} | ||
exports.getLocalCacheFolder = getLocalCacheFolder; | ||
// not expected to be called externally (exposed for testing) | ||
@@ -305,0 +314,0 @@ function ensureDockerfileHasFinalStageName(dockerfile, defaultLastStageName) { |
{ | ||
"name": "@devcontainers/cli", | ||
"description": "Dev Containers CLI", | ||
"version": "0.6.0", | ||
"version": "0.7.0", | ||
"bin": { | ||
@@ -77,3 +77,3 @@ "devcontainer": "devcontainer.js" | ||
"tar": "^6.1.11", | ||
"vscode-dev-containers": "https://github.com/microsoft/vscode-dev-containers/releases/download/v0.238.1/vscode-dev-containers-0.238.1.tgz", | ||
"vscode-dev-containers": "https://github.com/microsoft/vscode-dev-containers/releases/download/v0.241.1/vscode-dev-containers-0.241.1.tgz", | ||
"vscode-uri": "^3.0.3", | ||
@@ -80,0 +80,0 @@ "yargs": "~17.0.1" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
HTTP dependency
Supply chain riskContains a dependency which resolves to a remote HTTP URL which could be used to inject untrusted code and reduce overall package reliability.
Found 1 instance in 1 package
1456472
12408