diff --git a/src/lib/buildPacks/deno.ts b/src/lib/buildPacks/deno.ts new file mode 100644 index 000000000..ac06cc177 --- /dev/null +++ b/src/lib/buildPacks/deno.ts @@ -0,0 +1,41 @@ +import { buildImage } from '$lib/docker'; +import { promises as fs } from 'fs'; + +const createDockerfile = async (data, image): Promise => { + const { workdir, port, startCommand, baseDirectory, secrets, pullmergeRequestId } = data; + const Dockerfile: Array = []; + + 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; + } +} diff --git a/src/lib/buildPacks/index.ts b/src/lib/buildPacks/index.ts index babbe8f17..ac31afc16 100644 --- a/src/lib/buildPacks/index.ts +++ b/src/lib/buildPacks/index.ts @@ -13,6 +13,7 @@ import rust from './rust'; import astro from './static'; import eleventy from './static'; import python from './python'; +import deno from './deno'; export { node, @@ -29,5 +30,6 @@ export { rust, astro, eleventy, - python + python, + deno }; diff --git a/src/lib/components/common.ts b/src/lib/components/common.ts index 2bd962c4c..6bc60202d 100644 --- a/src/lib/components/common.ts +++ b/src/lib/components/common.ts @@ -19,7 +19,7 @@ export const staticDeployments = [ 'astro', 'eleventy' ]; -export const notNodeDeployments = ['php', 'docker', 'rust', 'python']; +export const notNodeDeployments = ['php', 'docker', 'rust', 'python', 'deno']; export function getDomain(domain) { return domain?.replace('https://', '').replace('http://', ''); diff --git a/src/lib/components/svg/applications/Deno.svelte b/src/lib/components/svg/applications/Deno.svelte new file mode 100644 index 000000000..4e1794226 --- /dev/null +++ b/src/lib/components/svg/applications/Deno.svelte @@ -0,0 +1,24 @@ + diff --git a/src/lib/components/templates.ts b/src/lib/components/templates.ts index b82b12f51..99aceabfe 100644 --- a/src/lib/components/templates.ts +++ b/src/lib/components/templates.ts @@ -153,6 +153,16 @@ export function findBuildPack(pack, packageManager = 'npm') { port: 8000 }; } + if (pack === 'deno') { + return { + ...metaData, + installCommand: `yarn install`, + buildCommand: `yarn build`, + startCommand: null, + publishDirectory: `_site`, + port: 80 + }; + } return { name: 'node', fancyName: 'Node.js', @@ -262,6 +272,12 @@ export const buildPacks = [ fancyName: 'Python', hoverColor: 'hover:bg-green-700', color: 'bg-green-700' + }, + { + name: 'deno', + fancyName: 'Deno', + hoverColor: 'hover:bg-green-700', + color: 'bg-green-700' } ]; export const scanningTemplates = { diff --git a/src/routes/applications/[id]/index.svelte b/src/routes/applications/[id]/index.svelte index b1939913e..690d97f97 100644 --- a/src/routes/applications/[id]/index.svelte +++ b/src/routes/applications/[id]/index.svelte @@ -432,6 +432,18 @@ /> {/if} + {#if application.buildPack === 'deno'} +
+ + +
+ {/if}