feat: Add PHP modules
This commit is contained in:
@@ -4,9 +4,15 @@ import { promises as fs } from 'fs';
|
||||
const createDockerfile = async (data, image): Promise<void> => {
|
||||
const { workdir, baseDirectory } = data;
|
||||
const Dockerfile: Array<string> = [];
|
||||
|
||||
Dockerfile.push(`FROM ${image}`);
|
||||
Dockerfile.push(`LABEL coolify.image=true`);
|
||||
if (data.phpModules?.length > 0) {
|
||||
Dockerfile.push(
|
||||
`ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/`
|
||||
);
|
||||
Dockerfile.push(`RUN chmod +x /usr/local/bin/install-php-extensions`);
|
||||
Dockerfile.push(`RUN /usr/local/bin/install-php-extensions ${data.phpModules.join(' ')}`);
|
||||
}
|
||||
Dockerfile.push('RUN a2enmod rewrite');
|
||||
Dockerfile.push('WORKDIR /var/www/html');
|
||||
Dockerfile.push(`COPY .${baseDirectory || ''} /var/www/html`);
|
||||
|
||||
@@ -156,6 +156,9 @@ export async function getApplication({ id, teamId }) {
|
||||
return s;
|
||||
});
|
||||
}
|
||||
if (body?.phpModules) {
|
||||
body.phpModules = body.phpModules.split(',');
|
||||
}
|
||||
|
||||
return { ...body };
|
||||
}
|
||||
@@ -211,7 +214,8 @@ export async function configureApplication({
|
||||
buildCommand,
|
||||
startCommand,
|
||||
baseDirectory,
|
||||
publishDirectory
|
||||
publishDirectory,
|
||||
phpModules
|
||||
}) {
|
||||
return await prisma.application.update({
|
||||
where: { id },
|
||||
@@ -224,7 +228,8 @@ export async function configureApplication({
|
||||
startCommand,
|
||||
baseDirectory,
|
||||
publishDirectory,
|
||||
name
|
||||
name,
|
||||
phpModules
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ export default async function (job) {
|
||||
publishDirectory,
|
||||
projectId,
|
||||
secrets,
|
||||
phpModules,
|
||||
type,
|
||||
pullmergeRequestId = null,
|
||||
sourceBranch = null,
|
||||
@@ -179,7 +180,8 @@ export default async function (job) {
|
||||
buildCommand,
|
||||
startCommand,
|
||||
baseDirectory,
|
||||
secrets
|
||||
secrets,
|
||||
phpModules
|
||||
});
|
||||
else {
|
||||
saveBuildLog({ line: `Build pack ${buildPack} not found`, buildId, applicationId });
|
||||
|
||||
Reference in New Issue
Block a user