Skip to content

Commit

Permalink
reverted change in docker-image-client.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
schummar committed Jun 10, 2024
1 parent 7cae6d1 commit 1b9bea5
Showing 1 changed file with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,13 @@ export class DockerImageClient implements ImageClient {
constructor(protected readonly dockerode: Dockerode, protected readonly indexServerAddress: string) {}

async build(context: string, opts: ImageBuildOptions): Promise<void> {
const cleanOpts = Object.fromEntries(
Object.entries(opts).filter(([_, value]) => value !== undefined)
) as ImageBuildOptions;

try {
log.debug(`Building image "${cleanOpts.t}" with context "${context}"...`);
log.debug(`Building image "${opts.t}" with context "${context}"...`);
const isDockerIgnored = await this.createIsDockerIgnoredFunction(context);
const tarStream = tar.pack(context, {
ignore: (aPath) => {
const relativePath = path.relative(context, aPath);
if (relativePath === cleanOpts.dockerfile) {
if (relativePath === opts.dockerfile) {
return false;
} else {
return isDockerIgnored(relativePath);
Expand All @@ -36,19 +32,19 @@ export class DockerImageClient implements ImageClient {
});
await new Promise<void>((resolve) => {
this.dockerode
.buildImage(tarStream, cleanOpts)
.buildImage(tarStream, opts)
.then((stream) => byline(stream))
.then((stream) => {
stream.setEncoding("utf-8");
stream.on("data", (line) => {
if (buildLog.enabled()) {
buildLog.trace(line, { imageName: cleanOpts.t });
buildLog.trace(line, { imageName: opts.t });
}
});
stream.on("end", () => resolve());
});
});
log.debug(`Built image "${cleanOpts.t}" with context "${context}"`);
log.debug(`Built image "${opts.t}" with context "${context}"`);
} catch (err) {
log.error(`Failed to build image: ${err}`);
throw err;
Expand Down

0 comments on commit 1b9bea5

Please sign in to comment.