(npmRegistry: string, npmTag: string, dockerTags: string[], dev: boolean)
| 4 | const IMAGES = ['airnode-admin', 'airnode-deployer', 'airnode-client']; |
| 5 | |
| 6 | export const buildDockerImages = (npmRegistry: string, npmTag: string, dockerTags: string[], dev: boolean) => { |
| 7 | let npmRegistryUrl = npmRegistry; |
| 8 | const devSuffix = dev ? '-dev' : ''; |
| 9 | const firstDockerTag = dockerTags[0]; |
| 10 | |
| 11 | if (npmRegistry === 'local') { |
| 12 | const npmRegistryInfo = getNpmRegistryContainer(); |
| 13 | if (!npmRegistryInfo) { |
| 14 | throw new Error(`Can't build Docker images: No local NPM registry running`); |
| 15 | } |
| 16 | |
| 17 | npmRegistryUrl = npmRegistryInfo.npmRegistryUrl; |
| 18 | } |
| 19 | |
| 20 | npmRegistryUrl = unifyUrlFormat(npmRegistryUrl); |
| 21 | |
| 22 | for (const imageName of IMAGES) { |
| 23 | runCommand( |
| 24 | `docker build --no-cache --build-arg npmRegistryUrl=${npmRegistryUrl} --build-arg npmTag=${npmTag} --tag api3/${imageName}${devSuffix}:${firstDockerTag} --file /app/${imageName}/Dockerfile /app/${imageName}` |
| 25 | ); |
| 26 | |
| 27 | for (const additionalTag of dockerTags.slice(1)) { |
| 28 | runCommand( |
| 29 | `docker tag api3/${imageName}${devSuffix}:${firstDockerTag} api3/${imageName}${devSuffix}:${additionalTag}` |
| 30 | ); |
| 31 | } |
| 32 | } |
| 33 | }; |
| 34 | |
| 35 | const loginDockerHub = () => { |
| 36 | const username = process.env.DOCKERHUB_USERNAME; |
no test coverage detected