dank-ai 1.0.27 → 1.0.29
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/docker/manager.js +34 -46
- package/package.json +1 -1
package/lib/docker/manager.js
CHANGED
|
@@ -1149,14 +1149,21 @@ class DockerManager {
|
|
|
1149
1149
|
|
|
1150
1150
|
try {
|
|
1151
1151
|
const buildContext = await this.createAgentBuildContext(agent);
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1152
|
+
const dockerCmd = await this.resolveDockerCommand();
|
|
1153
|
+
|
|
1154
|
+
const buildCommand = [
|
|
1155
|
+
dockerCmd,
|
|
1156
|
+
'buildx',
|
|
1157
|
+
'build',
|
|
1158
|
+
'--platform', 'linux/amd64',
|
|
1159
|
+
'--tag', imageName,
|
|
1160
|
+
'--file', path.join(buildContext, 'Dockerfile'),
|
|
1161
|
+
'--load',
|
|
1162
|
+
...(options.rebuild || options.noCache ? ['--no-cache'] : []),
|
|
1163
|
+
buildContext
|
|
1164
|
+
].join(' ');
|
|
1165
|
+
|
|
1166
|
+
await this.runCommand(buildCommand, `Agent ${agent.name} build`);
|
|
1160
1167
|
|
|
1161
1168
|
this.logger.info(`Agent image '${imageName}' built successfully`);
|
|
1162
1169
|
|
|
@@ -1214,50 +1221,31 @@ class DockerManager {
|
|
|
1214
1221
|
|
|
1215
1222
|
try {
|
|
1216
1223
|
const buildContext = await this.createAgentBuildContext(agent);
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1224
|
+
const dockerCmd = await this.resolveDockerCommand();
|
|
1225
|
+
|
|
1226
|
+
const buildCommand = [
|
|
1227
|
+
dockerCmd,
|
|
1228
|
+
'buildx',
|
|
1229
|
+
'build',
|
|
1230
|
+
'--platform', 'linux/amd64',
|
|
1231
|
+
'--tag', imageName,
|
|
1232
|
+
'--file', path.join(buildContext, 'Dockerfile'),
|
|
1233
|
+
...(push ? ['--push'] : ['--load']),
|
|
1234
|
+
...(force ? ['--no-cache'] : []),
|
|
1235
|
+
buildContext
|
|
1236
|
+
].join(' ');
|
|
1237
|
+
|
|
1238
|
+
await this.runCommand(buildCommand, `Production build for ${agent.name}`);
|
|
1228
1239
|
|
|
1229
1240
|
this.logger.info(`Production image '${imageName}' built successfully`);
|
|
1241
|
+
if (push) {
|
|
1242
|
+
this.logger.info(`Successfully pushed image: ${imageName}`);
|
|
1243
|
+
}
|
|
1230
1244
|
|
|
1231
1245
|
// Clean up build context
|
|
1232
1246
|
await fs.remove(buildContext);
|
|
1233
1247
|
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
// Push to registry if requested (use docker CLI for reliability)
|
|
1237
|
-
if (push) {
|
|
1238
|
-
const dockerCmd = await this.resolveDockerCommand();
|
|
1239
|
-
const maxAttempts = 3;
|
|
1240
|
-
for (let attempt = 1; attempt <= maxAttempts; attempt++) {
|
|
1241
|
-
try {
|
|
1242
|
-
this.logger.info(`Pushing image to registry (attempt ${attempt}/${maxAttempts}): ${imageName}`);
|
|
1243
|
-
await this.runCommand(`${dockerCmd} push ${imageName}`, `Docker push ${imageName}`);
|
|
1244
|
-
this.logger.info(`Successfully pushed image: ${imageName}`);
|
|
1245
|
-
pushed = true;
|
|
1246
|
-
break;
|
|
1247
|
-
} catch (pushError) {
|
|
1248
|
-
const msg = pushError?.message || '';
|
|
1249
|
-
this.logger.warn(`Push attempt ${attempt} failed: ${msg}`);
|
|
1250
|
-
if (msg.match(/denied|unauthorized|authentication required/i)) {
|
|
1251
|
-
this.logger.warn("Authentication issue detected. Please ensure you're logged in: docker login <registry>");
|
|
1252
|
-
break; // don't retry auth failures automatically
|
|
1253
|
-
}
|
|
1254
|
-
if (attempt < maxAttempts) {
|
|
1255
|
-
await this.sleep(2000 * attempt);
|
|
1256
|
-
continue;
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
}
|
|
1260
|
-
}
|
|
1248
|
+
const pushed = push;
|
|
1261
1249
|
|
|
1262
1250
|
return {
|
|
1263
1251
|
imageName,
|