2022-08-11 13:20:34 +00:00
|
|
|
import { executeDockerCmd, prisma } from "../common"
|
2022-08-11 14:17:07 +00:00
|
|
|
import { saveBuildLog } from "./common";
|
2022-08-11 13:20:34 +00:00
|
|
|
|
|
|
|
|
export default async function (data: any): Promise<void> {
|
2022-11-02 14:36:23 +00:00
|
|
|
const { buildId, applicationId, tag, dockerId, debug, workdir, baseDirectory, baseImage } = data
|
2022-08-11 14:17:07 +00:00
|
|
|
try {
|
|
|
|
|
await saveBuildLog({ line: `Building image started.`, buildId, applicationId });
|
2022-09-25 08:00:53 +00:00
|
|
|
await executeDockerCmd({
|
2022-11-02 14:36:23 +00:00
|
|
|
buildId,
|
2022-09-25 08:00:53 +00:00
|
|
|
debug,
|
2022-08-11 14:17:07 +00:00
|
|
|
dockerId,
|
2022-11-02 14:36:23 +00:00
|
|
|
command: `pack build -p ${workdir}${baseDirectory} ${applicationId}:${tag} --builder ${baseImage}`
|
2022-08-11 14:17:07 +00:00
|
|
|
})
|
|
|
|
|
await saveBuildLog({ line: `Building image successful.`, buildId, applicationId });
|
|
|
|
|
} catch (error) {
|
|
|
|
|
throw error;
|
|
|
|
|
}
|
2022-08-11 13:20:34 +00:00
|
|
|
}
|