MCPcopy Index your code
hub / github.com/serverless/serverless / buildImage

Function buildImage

packages/serverless/lib/plugins/python/lib/docker.js:38–56  ·  view source on GitHub ↗

* Build the custom Docker image * @param {string} dockerFile * @param {string[]} extraArgs * @return {string} The name of the built docker image.

(dockerFile, extraArgs, pluginInstance)

Source from the content-addressed store, hash-verified

36 * @return {string} The name of the built docker image.
37 */
38async function buildImage(dockerFile, extraArgs, pluginInstance) {
39 const imageName = 'sls-py-reqs-custom'
40 const options = ['build', '-f', dockerFile, '-t', imageName]
41
42 if (Array.isArray(extraArgs)) {
43 options.push(...extraArgs)
44 } else {
45 throw new ServerlessError(
46 'dockerRunCmdExtraArgs option must be an array',
47 'PYTHON_REQUIREMENTS_INVALID_DOCKER_EXTRA_ARGS',
48 { stack: false },
49 )
50 }
51
52 options.push('.')
53
54 await dockerCommand(options, pluginInstance)
55 return imageName
56}
57
58/**
59 * Find a file that exists on all projects so we can test if Docker can see it too

Callers 1

installRequirementsFunction · 0.90

Calls 1

dockerCommandFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…