v1.0.12 - Sveltekit migration (#44)
Changed the whole tech stack to SvelteKit which means: - Typescript - SSR - No fastify :( - Beta, but it's fine! Other changes: - Tailwind -> Tailwind JIT - A lot more
This commit is contained in:
29
src/lib/api/applications/buildContainer.ts
Normal file
29
src/lib/api/applications/buildContainer.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import Deployment from '$models/Logs/Deployment';
|
||||
import { saveAppLog } from './logging';
|
||||
import * as packs from './packs';
|
||||
|
||||
export default async function (configuration) {
|
||||
const { id, organization, name, branch } = configuration.repository;
|
||||
const { domain } = configuration.publish;
|
||||
const deployId = configuration.general.deployId;
|
||||
const execute = packs[configuration.build.pack];
|
||||
if (execute) {
|
||||
await Deployment.findOneAndUpdate(
|
||||
{ repoId: id, branch, deployId, organization, name, domain },
|
||||
{ repoId: id, branch, deployId, organization, name, domain, progress: 'inprogress' }
|
||||
);
|
||||
await saveAppLog('### Building application.', configuration);
|
||||
await execute(configuration);
|
||||
await saveAppLog('### Building done.', configuration);
|
||||
} else {
|
||||
try {
|
||||
await Deployment.findOneAndUpdate(
|
||||
{ repoId: id, branch, deployId, organization, name, domain },
|
||||
{ repoId: id, branch, deployId, organization, name, domain, progress: 'failed' }
|
||||
);
|
||||
} catch (error) {
|
||||
// Hmm.
|
||||
}
|
||||
throw new Error('No buildpack found.');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user