chore: format whole repository with new configs

This commit is contained in:
Krzysztof Durek
2024-07-15 01:08:18 +02:00
parent 7a5c71cda3
commit 906e8de13b
349 changed files with 3565 additions and 3549 deletions

View File

@@ -1,40 +1,40 @@
import { docker } from "@/server/constants";
import type { WriteStream } from "node:fs";
import { docker } from "@/server/constants";
import * as tar from "tar-fs";
import type { ApplicationNested } from ".";
import { getBuildAppDirectory } from "../filesystem/directory";
export const buildCustomDocker = async (
application: ApplicationNested,
writeStream: WriteStream,
application: ApplicationNested,
writeStream: WriteStream,
) => {
const { appName } = application;
const dockerFilePath = getBuildAppDirectory(application);
try {
const image = `${appName}`;
const contextPath =
dockerFilePath.substring(0, dockerFilePath.lastIndexOf("/") + 1) || ".";
const tarStream = tar.pack(contextPath);
const { appName } = application;
const dockerFilePath = getBuildAppDirectory(application);
try {
const image = `${appName}`;
const contextPath =
dockerFilePath.substring(0, dockerFilePath.lastIndexOf("/") + 1) || ".";
const tarStream = tar.pack(contextPath);
const stream = await docker.buildImage(tarStream, {
t: image,
dockerfile: dockerFilePath.substring(dockerFilePath.lastIndexOf("/") + 1),
// TODO: maybe use or not forcerm
// forcerm: true,
});
const stream = await docker.buildImage(tarStream, {
t: image,
dockerfile: dockerFilePath.substring(dockerFilePath.lastIndexOf("/") + 1),
// TODO: maybe use or not forcerm
// forcerm: true,
});
await new Promise((resolve, reject) => {
docker.modem.followProgress(
stream,
(err, res) => (err ? reject(err) : resolve(res)),
(event) => {
if (event.stream) {
writeStream.write(event.stream);
}
},
);
});
} catch (error) {
throw error;
}
await new Promise((resolve, reject) => {
docker.modem.followProgress(
stream,
(err, res) => (err ? reject(err) : resolve(res)),
(event) => {
if (event.stream) {
writeStream.write(event.stream);
}
},
);
});
} catch (error) {
throw error;
}
};