feat: initial deno support
This commit is contained in:
41
src/lib/buildPacks/deno.ts
Normal file
41
src/lib/buildPacks/deno.ts
Normal file
@@ -0,0 +1,41 @@
|
|||||||
|
import { buildImage } from '$lib/docker';
|
||||||
|
import { promises as fs } from 'fs';
|
||||||
|
|
||||||
|
const createDockerfile = async (data, image): Promise<void> => {
|
||||||
|
const { workdir, port, startCommand, baseDirectory, secrets, pullmergeRequestId } = data;
|
||||||
|
const Dockerfile: Array<string> = [];
|
||||||
|
|
||||||
|
Dockerfile.push(`FROM ${image}`);
|
||||||
|
Dockerfile.push('WORKDIR /app');
|
||||||
|
Dockerfile.push(`LABEL coolify.image=true`);
|
||||||
|
if (secrets.length > 0) {
|
||||||
|
secrets.forEach((secret) => {
|
||||||
|
if (secret.isBuildSecret) {
|
||||||
|
if (pullmergeRequestId) {
|
||||||
|
if (secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!secret.isPRMRSecret) {
|
||||||
|
Dockerfile.push(`ARG ${secret.name}=${secret.value}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Dockerfile.push(`COPY .${baseDirectory || ''} ./`);
|
||||||
|
Dockerfile.push(`ENV NO_COLOR true`);
|
||||||
|
Dockerfile.push(`EXPOSE ${port}`);
|
||||||
|
Dockerfile.push(`CMD ${startCommand}`);
|
||||||
|
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
|
||||||
|
};
|
||||||
|
|
||||||
|
export default async function (data) {
|
||||||
|
try {
|
||||||
|
const image = 'denoland/deno:latest';
|
||||||
|
await createDockerfile(data, image);
|
||||||
|
await buildImage(data);
|
||||||
|
} catch (error) {
|
||||||
|
throw error;
|
||||||
|
}
|
||||||
|
}
|
@@ -13,6 +13,7 @@ import rust from './rust';
|
|||||||
import astro from './static';
|
import astro from './static';
|
||||||
import eleventy from './static';
|
import eleventy from './static';
|
||||||
import python from './python';
|
import python from './python';
|
||||||
|
import deno from './deno';
|
||||||
|
|
||||||
export {
|
export {
|
||||||
node,
|
node,
|
||||||
@@ -29,5 +30,6 @@ export {
|
|||||||
rust,
|
rust,
|
||||||
astro,
|
astro,
|
||||||
eleventy,
|
eleventy,
|
||||||
python
|
python,
|
||||||
|
deno
|
||||||
};
|
};
|
||||||
|
@@ -19,7 +19,7 @@ export const staticDeployments = [
|
|||||||
'astro',
|
'astro',
|
||||||
'eleventy'
|
'eleventy'
|
||||||
];
|
];
|
||||||
export const notNodeDeployments = ['php', 'docker', 'rust', 'python'];
|
export const notNodeDeployments = ['php', 'docker', 'rust', 'python', 'deno'];
|
||||||
|
|
||||||
export function getDomain(domain) {
|
export function getDomain(domain) {
|
||||||
return domain?.replace('https://', '').replace('http://', '');
|
return domain?.replace('https://', '').replace('http://', '');
|
||||||
|
24
src/lib/components/svg/applications/Deno.svelte
Normal file
24
src/lib/components/svg/applications/Deno.svelte
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 6.1 KiB |
@@ -153,6 +153,16 @@ export function findBuildPack(pack, packageManager = 'npm') {
|
|||||||
port: 8000
|
port: 8000
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
if (pack === 'deno') {
|
||||||
|
return {
|
||||||
|
...metaData,
|
||||||
|
installCommand: `yarn install`,
|
||||||
|
buildCommand: `yarn build`,
|
||||||
|
startCommand: null,
|
||||||
|
publishDirectory: `_site`,
|
||||||
|
port: 80
|
||||||
|
};
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
name: 'node',
|
name: 'node',
|
||||||
fancyName: 'Node.js',
|
fancyName: 'Node.js',
|
||||||
@@ -262,6 +272,12 @@ export const buildPacks = [
|
|||||||
fancyName: 'Python',
|
fancyName: 'Python',
|
||||||
hoverColor: 'hover:bg-green-700',
|
hoverColor: 'hover:bg-green-700',
|
||||||
color: 'bg-green-700'
|
color: 'bg-green-700'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'deno',
|
||||||
|
fancyName: 'Deno',
|
||||||
|
hoverColor: 'hover:bg-green-700',
|
||||||
|
color: 'bg-green-700'
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
export const scanningTemplates = {
|
export const scanningTemplates = {
|
||||||
|
@@ -420,6 +420,18 @@
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
{#if application.buildPack === 'deno'}
|
||||||
|
<div class="grid grid-cols-2 items-center">
|
||||||
|
<label for="startCommand" class="text-base font-bold text-stone-100">Start Command</label>
|
||||||
|
<input
|
||||||
|
readonly={!$session.isAdmin}
|
||||||
|
name="startCommand"
|
||||||
|
id="startCommand"
|
||||||
|
bind:value={application.startCommand}
|
||||||
|
placeholder="default: deno run main.js"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
<div class="grid grid-cols-2 items-center">
|
<div class="grid grid-cols-2 items-center">
|
||||||
<div class="flex-col">
|
<div class="flex-col">
|
||||||
<label for="baseDirectory" class="pt-2 text-base font-bold text-stone-100"
|
<label for="baseDirectory" class="pt-2 text-base font-bold text-stone-100"
|
||||||
|
@@ -19,6 +19,7 @@
|
|||||||
import Docker from '$lib/components/svg/applications/Docker.svelte';
|
import Docker from '$lib/components/svg/applications/Docker.svelte';
|
||||||
import Astro from '$lib/components/svg/applications/Astro.svelte';
|
import Astro from '$lib/components/svg/applications/Astro.svelte';
|
||||||
import Eleventy from '$lib/components/svg/applications/Eleventy.svelte';
|
import Eleventy from '$lib/components/svg/applications/Eleventy.svelte';
|
||||||
|
import Deno from '$lib/components/svg/applications/Deno.svelte';
|
||||||
import { getDomain } from '$lib/components/common';
|
import { getDomain } from '$lib/components/common';
|
||||||
|
|
||||||
async function newApplication() {
|
async function newApplication() {
|
||||||
@@ -100,6 +101,8 @@
|
|||||||
<Astro />
|
<Astro />
|
||||||
{:else if application.buildPack.toLowerCase() === 'eleventy'}
|
{:else if application.buildPack.toLowerCase() === 'eleventy'}
|
||||||
<Eleventy />
|
<Eleventy />
|
||||||
|
{:else if application.buildPack.toLowerCase() === 'deno'}
|
||||||
|
<Deno />
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
@@ -156,6 +159,8 @@
|
|||||||
<Astro />
|
<Astro />
|
||||||
{:else if application.buildPack.toLowerCase() === 'eleventy'}
|
{:else if application.buildPack.toLowerCase() === 'eleventy'}
|
||||||
<Eleventy />
|
<Eleventy />
|
||||||
|
{:else if application.buildPack.toLowerCase() === 'deno'}
|
||||||
|
<Deno />
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user