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

@@ -28,12 +28,15 @@
delete tempBuildPack.fancyName;
delete tempBuildPack.color;
delete tempBuildPack.hoverColor;
let composeConfiguration: any = {}
if (!dockerComposeConfiguration && dockerComposeFile) {
for (const [name, _] of Object.entries(JSON.parse(dockerComposeFile).services)) {
let composeConfiguration: any = {};
if (!dockerComposeConfiguration && dockerComposeFile && buildPack.name === 'compose') {
const parsed = JSON.parse(dockerComposeFile);
if (!parsed?.services) {
throw new Error('No services found in docker-compose file. <br>Choose a different buildpack.');
}
for (const [name, _] of Object.entries(parsed.services)) {
composeConfiguration[name] = {};
}
}
await post(`/applications/${id}`, {
...tempBuildPack,

View File

@@ -366,6 +366,10 @@
async function reloadCompose() {
if (loading.reloadCompose) return;
loading.reloadCompose = true;
if (!$appSession.tokens.github) {
const { token } = await get(`/applications/${id}/configuration/githubToken`);
$appSession.tokens.github = token;
}
try {
if (application.gitSource.type === 'github') {
const composeLocation = application.dockerComposeFileLocation.startsWith('/')

View File

@@ -21,7 +21,7 @@
onMount(async () => {
const response = await get(`/applications/${id}`);
application = response.application;
if (response.application.dockerComposeFile) {
if (response.application.dockerComposeFile && application.buildPack === 'compose') {
services = normalizeDockerServices(
JSON.parse(response.application.dockerComposeFile).services
);

View File

@@ -55,7 +55,7 @@
onMount(async () => {
const response = await get(`/applications/${id}`);
application = response.application;
if (response.application.dockerComposeFile) {
if (response.application.dockerComposeFile && application.buildPack === 'compose') {
services = normalizeDockerServices(
JSON.parse(response.application.dockerComposeFile).services
);