Skip to content

Commit 55c8227

Browse files
committed
Run prettier
1 parent 4e44bf2 commit 55c8227

File tree

2 files changed

+42
-32
lines changed

2 files changed

+42
-32
lines changed

deploy/lib/buildAndPushContainers.js

Lines changed: 32 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
"use strict";
22

33
const Docker = require("dockerode");
4-
const path = require('path');
5-
const fs = require('fs');
4+
const path = require("path");
5+
const fs = require("fs");
66

77
const docker = new Docker();
88

@@ -46,30 +46,31 @@ function findErrorInBuildOutput(buildOutput) {
4646
}
4747

4848
function getFilesInBuildContextDirectory(directory) {
49-
let files = [];
49+
let files = [];
5050

51-
try {
52-
const dirents = fs.readdirSync(directory, { withFileTypes: true });
53-
54-
dirents.forEach(dirent => {
55-
const absolutePath = path.join(directory, dirent.name);
56-
if (dirent.isDirectory()) {
57-
const subFiles = getFilesInBuildContextDirectory(absolutePath);
58-
59-
// Prepend the current directory name to each subfile path
60-
const relativeSubFiles = subFiles.map(subFile => path.join(dirent.name, subFile));
61-
files = files.concat(relativeSubFiles);
62-
} else if (dirent.isFile() && dirent.name !== '.dockerignore') {
63-
// Don't include .dockerignore file in result
64-
files.push(dirent.name);
65-
}
66-
}
67-
);
68-
} catch (err) {
69-
console.error(`Error reading directory ${directory}:`, err);
70-
}
51+
try {
52+
const dirents = fs.readdirSync(directory, { withFileTypes: true });
53+
54+
dirents.forEach((dirent) => {
55+
const absolutePath = path.join(directory, dirent.name);
56+
if (dirent.isDirectory()) {
57+
const subFiles = getFilesInBuildContextDirectory(absolutePath);
7158

72-
return files;
59+
// Prepend the current directory name to each subfile path
60+
const relativeSubFiles = subFiles.map((subFile) =>
61+
path.join(dirent.name, subFile)
62+
);
63+
files = files.concat(relativeSubFiles);
64+
} else if (dirent.isFile() && dirent.name !== ".dockerignore") {
65+
// Don't include .dockerignore file in result
66+
files.push(dirent.name);
67+
}
68+
});
69+
} catch (err) {
70+
console.error(`Error reading directory ${directory}:`, err);
71+
}
72+
73+
return files;
7374
}
7475

7576
module.exports = {
@@ -109,10 +110,13 @@ module.exports = {
109110
return new Promise(async (resolve, reject) => {
110111
let files = getFilesInBuildContextDirectory(container.directory);
111112

112-
const buildStream = await docker.buildImage({context: container.directory, src: files}, {
113-
t: imageName,
114-
registryconfig: registryAuth,
115-
});
113+
const buildStream = await docker.buildImage(
114+
{ context: container.directory, src: files },
115+
{
116+
t: imageName,
117+
registryconfig: registryAuth,
118+
}
119+
);
116120
const buildStreamEvents = await extractStreamContents(
117121
buildStream,
118122
this.provider.options.verbose

tests/containers/containers.test.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,16 @@ describe("Service Lifecyle Integration Test", () => {
112112

113113
await docker.checkAuth(registryAuth);
114114

115-
await docker.buildImage({context: path.join(tmpDir, "my-container"), src: ["Dockerfile", "server.py", "requirements.txt"]}, {
116-
t: imageName,
117-
registryconfig: registryAuth,
118-
});
115+
await docker.buildImage(
116+
{
117+
context: path.join(tmpDir, "my-container"),
118+
src: ["Dockerfile", "server.py", "requirements.txt"],
119+
},
120+
{
121+
t: imageName,
122+
registryconfig: registryAuth,
123+
}
124+
);
119125
const image = docker.getImage(imageName);
120126
await image.push(auth);
121127

0 commit comments

Comments
 (0)