* Build the custom Docker image * @param {string} dockerFile * @param {string[]} extraArgs * @return {string} The name of the built docker image.
(dockerFile, extraArgs, pluginInstance)
| 36 | * @return {string} The name of the built docker image. |
| 37 | */ |
| 38 | async 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 |
no test coverage detected
searching dependent graphs…