MCPcopy Create free account
hub / github.com/api3dao/airnode / buildDockerImages

Function buildDockerImages

docker/scripts/docker.ts:6–33  ·  view source on GitHub ↗
(npmRegistry: string, npmTag: string, dockerTags: string[], dev: boolean)

Source from the content-addressed store, hash-verified

4const IMAGES = ['airnode-admin', 'airnode-deployer', 'airnode-client'];
5
6export 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
35const loginDockerHub = () => {
36 const username = process.env.DOCKERHUB_USERNAME;

Callers 1

cli.tsFile · 0.90

Calls 3

getNpmRegistryContainerFunction · 0.90
unifyUrlFormatFunction · 0.90
runCommandFunction · 0.90

Tested by

no test coverage detected