feat: docker compose
This commit is contained in:
@@ -2,7 +2,6 @@ import { promises as fs } from 'fs';
|
|||||||
import { defaultComposeConfiguration, executeDockerCmd } from '../common';
|
import { defaultComposeConfiguration, executeDockerCmd } from '../common';
|
||||||
import { buildImage, saveBuildLog } from './common';
|
import { buildImage, saveBuildLog } from './common';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import { getSecrets } from '../../routes/api/v1/applications/handlers';
|
|
||||||
|
|
||||||
export default async function (data) {
|
export default async function (data) {
|
||||||
let {
|
let {
|
||||||
@@ -41,20 +40,18 @@ export default async function (data) {
|
|||||||
const envs = [
|
const envs = [
|
||||||
`PORT=${port}`
|
`PORT=${port}`
|
||||||
];
|
];
|
||||||
if (getSecrets.length > 0) {
|
if (secrets.length > 0) {
|
||||||
secrets.forEach((secret) => {
|
secrets.forEach((secret) => {
|
||||||
if (secret.isBuildSecret) {
|
if (pullmergeRequestId) {
|
||||||
if (pullmergeRequestId) {
|
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
|
||||||
const isSecretFound = secrets.filter(s => s.name === secret.name && s.isPRMRSecret)
|
if (isSecretFound.length > 0) {
|
||||||
if (isSecretFound.length > 0) {
|
envs.push(`${secret.name}=${isSecretFound[0].value}`);
|
||||||
envs.push(`${secret.name}=${isSecretFound[0].value}`);
|
|
||||||
} else {
|
|
||||||
envs.push(`${secret.name}=${secret.value}`);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!secret.isPRMRSecret) {
|
envs.push(`${secret.name}=${secret.value}`);
|
||||||
envs.push(`${secret.name}=${secret.value}`);
|
}
|
||||||
}
|
} else {
|
||||||
|
if (!secret.isPRMRSecret) {
|
||||||
|
envs.push(`${secret.name}=${secret.value}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -66,6 +63,8 @@ export default async function (data) {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
//
|
//
|
||||||
}
|
}
|
||||||
|
console.log('envFound', envFound)
|
||||||
|
console.log(envs)
|
||||||
const composeVolumes = volumes.map((volume) => {
|
const composeVolumes = volumes.map((volume) => {
|
||||||
return {
|
return {
|
||||||
[`${volume.split(':')[0]}`]: {
|
[`${volume.split(':')[0]}`]: {
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
import Setting from '$lib/components/Setting.svelte';
|
import Setting from '$lib/components/Setting.svelte';
|
||||||
import Explainer from '$lib/components/Explainer.svelte';
|
import Explainer from '$lib/components/Explainer.svelte';
|
||||||
import { goto } from '$app/navigation';
|
import { goto } from '$app/navigation';
|
||||||
|
import Beta from '$lib/components/Beta.svelte';
|
||||||
|
|
||||||
const { id } = $page.params;
|
const { id } = $page.params;
|
||||||
|
|
||||||
@@ -257,10 +258,11 @@
|
|||||||
|
|
||||||
forceSave = false;
|
forceSave = false;
|
||||||
|
|
||||||
toast && addToast({
|
toast &&
|
||||||
message: 'Configuration saved.',
|
addToast({
|
||||||
type: 'success'
|
message: 'Configuration saved.',
|
||||||
});
|
type: 'success'
|
||||||
|
});
|
||||||
if (application.fqdn && application.fqdn.startsWith('https')) {
|
if (application.fqdn && application.fqdn.startsWith('https')) {
|
||||||
isHttps = true;
|
isHttps = true;
|
||||||
} else {
|
} else {
|
||||||
@@ -436,7 +438,7 @@
|
|||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="grid grid-cols-2 items-center">
|
<div class="grid grid-cols-2 items-center">
|
||||||
<label for="buildPack">{$t('application.build_pack')}</label>
|
<label for="buildPack">{$t('application.build_pack')} </label>
|
||||||
{#if isDisabled}
|
{#if isDisabled}
|
||||||
<input class="uppercase w-full" disabled={isDisabled} value={application.buildPack} />
|
<input class="uppercase w-full" disabled={isDisabled} value={application.buildPack} />
|
||||||
{:else}
|
{:else}
|
||||||
@@ -910,7 +912,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
<div class="title font-bold pb-3 pt-10 border-b border-coolgray-500 mb-6">
|
<div class="title font-bold pb-3 pt-10 border-b border-coolgray-500 mb-6">
|
||||||
Docker Compose
|
Stack <Beta />
|
||||||
{#if $appSession.isAdmin}
|
{#if $appSession.isAdmin}
|
||||||
<button
|
<button
|
||||||
class="btn btn-sm btn-primary"
|
class="btn btn-sm btn-primary"
|
||||||
@@ -921,7 +923,9 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="grid grid-flow-row gap-2">
|
<div class="grid grid-flow-row gap-2">
|
||||||
{#each dockerComposeServices as service}
|
{#each dockerComposeServices as service}
|
||||||
<div class="grid items-center bg-coolgray-100 rounded border border-coolgray-300 p-2 px-4">
|
<div
|
||||||
|
class="grid items-center bg-coolgray-100 rounded border border-coolgray-300 p-2 px-4"
|
||||||
|
>
|
||||||
<div class="text-xl font-bold uppercase">
|
<div class="text-xl font-bold uppercase">
|
||||||
{service.name}
|
{service.name}
|
||||||
<span
|
<span
|
||||||
@@ -934,7 +938,6 @@
|
|||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-xs">{application.id}-{service.name}</div>
|
<div class="text-xs">{application.id}-{service.name}</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="grid grid-cols-2 items-center px-8">
|
<div class="grid grid-cols-2 items-center px-8">
|
||||||
@@ -957,6 +960,30 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="grid grid-cols-2 items-center px-8">
|
||||||
|
<label for="destinationdns"
|
||||||
|
>Internal DNS on the deployed Destination
|
||||||
|
<Explainer
|
||||||
|
explanation={'You can use these DNS names to access the application from other resources in your Destination.'}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
for="destinationdns"
|
||||||
|
class="w-full"
|
||||||
|
disabled
|
||||||
|
readonly
|
||||||
|
value={`${application.id}-${service.name}`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div class="grid grid-cols-2 items-center px-8">
|
||||||
|
<label for="stackdns"
|
||||||
|
>Internal DNS in the current stack
|
||||||
|
<Explainer
|
||||||
|
explanation={'You can use these DNS names to access the application from this stack.'}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<input for="stackdns" class="w-full" disabled readonly value={service.name} />
|
||||||
|
</div>
|
||||||
<div class="grid grid-cols-2 items-center px-8 pb-4">
|
<div class="grid grid-cols-2 items-center px-8 pb-4">
|
||||||
<label for="port"
|
<label for="port"
|
||||||
>{$t('forms.port')}
|
>{$t('forms.port')}
|
||||||
|
Reference in New Issue
Block a user