WIP: Base image selector
This commit is contained in:
@@ -12,6 +12,17 @@ import type {
|
||||
Application,
|
||||
ApplicationPersistentStorage
|
||||
} from '@prisma/client';
|
||||
const nodeBased = [
|
||||
'react',
|
||||
'vuejs',
|
||||
'static',
|
||||
'svelte',
|
||||
'gatsby',
|
||||
'php',
|
||||
'astro',
|
||||
'eleventy',
|
||||
'node'
|
||||
];
|
||||
|
||||
export async function listApplications(teamId: string): Promise<Application[]> {
|
||||
if (teamId === '0') {
|
||||
@@ -195,6 +206,24 @@ export async function getApplication({ id, teamId }: { id: string; teamId: strin
|
||||
return s;
|
||||
});
|
||||
}
|
||||
// Set default build images
|
||||
if (!body.baseImage) {
|
||||
if (nodeBased.includes(body.buildPack)) {
|
||||
body.baseImage = 'node:lts';
|
||||
}
|
||||
if (body.buildPack === 'python') {
|
||||
body.baseImage = 'python:3-alpine';
|
||||
}
|
||||
if (body.buildPack === 'rust') {
|
||||
body.baseImage = 'rust:latest';
|
||||
}
|
||||
if (body.buildPack === 'deno') {
|
||||
body.baseImage = 'denoland/deno:latest';
|
||||
}
|
||||
if (body.buildPack === 'php') {
|
||||
body.baseImage = 'webdevops/php-apache:8.0-alpine';
|
||||
}
|
||||
}
|
||||
|
||||
return { ...body };
|
||||
}
|
||||
@@ -266,7 +295,8 @@ export async function configureApplication({
|
||||
pythonVariable,
|
||||
dockerFileLocation,
|
||||
denoMainFile,
|
||||
denoOptions
|
||||
denoOptions,
|
||||
baseImage
|
||||
}: {
|
||||
id: string;
|
||||
buildPack: string;
|
||||
@@ -284,6 +314,7 @@ export async function configureApplication({
|
||||
dockerFileLocation: string;
|
||||
denoMainFile: string;
|
||||
denoOptions: string;
|
||||
baseImage: string;
|
||||
}): Promise<Application> {
|
||||
return await prisma.application.update({
|
||||
where: { id },
|
||||
@@ -302,7 +333,8 @@ export async function configureApplication({
|
||||
pythonVariable,
|
||||
dockerFileLocation,
|
||||
denoMainFile,
|
||||
denoOptions
|
||||
denoOptions,
|
||||
baseImage
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user