fixes related to docker-compose

This commit is contained in:
Andras Bacsai
2023-01-16 09:44:08 +01:00
parent 5cb9216add
commit 18064ef6a2
11 changed files with 48 additions and 30 deletions

View File

@@ -1,7 +1,7 @@
import { promises as fs } from 'fs';
import { generateSecrets } from '../common';
import { saveBuildLog } from './common';
import yaml from 'js-yaml';
import { generateSecrets } from '../common';
import { defaultComposeConfiguration } from '../docker';
import { executeCommand } from '../executeCommand';
@@ -45,7 +45,10 @@ export default async function (data) {
let networks = {};
for (let [key, value] of Object.entries(dockerComposeYaml.services)) {
value['container_name'] = `${applicationId}-${key}`;
let environment = typeof value['environment'] === 'undefined' ? [] : value['environment']
let environment = typeof value['environment'] === 'undefined' ? [] : value['environment'];
if (Object.keys(environment).length > 0) {
environment = Object.entries(environment).map(([key, value]) => `${key}=${value}`);
}
value['environment'] = [...environment, ...envs];
value['labels'] = labels;
// TODO: If we support separated volume for each service, we need to add it here
@@ -97,7 +100,7 @@ export default async function (data) {
buildId,
applicationId,
dockerId,
command: `docker compose --project-directory ${workdir} pull`
command: `docker compose --project-directory ${workdir} -f ${fileYaml} pull`
});
await saveBuildLog({ line: 'Pulling images from Compose file...', buildId, applicationId });
await executeCommand({
@@ -105,7 +108,7 @@ export default async function (data) {
buildId,
applicationId,
dockerId,
command: `docker compose --project-directory ${workdir} build --progress plain`
command: `docker compose --project-directory ${workdir} -f ${fileYaml} build --progress plain`
});
await saveBuildLog({ line: 'Building images from Compose file...', buildId, applicationId });
}