commit
3ef093c7e6
@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "coolify",
|
||||
"description": "An open-source & self-hostable Heroku / Netlify alternative.",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"license": "AGPL-3.0",
|
||||
"scripts": {
|
||||
"dev": "docker-compose -f docker-compose-dev.yaml up -d && cross-env NODE_ENV=development & svelte-kit dev",
|
||||
|
@ -124,18 +124,7 @@ export const setDefaultConfiguration = async (data) => {
|
||||
|
||||
export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, applicationId) {
|
||||
try {
|
||||
// TODO: Write full .dockerignore for all deployments!!
|
||||
if (buildPack === 'php') {
|
||||
await fs.writeFile(
|
||||
`${workdir}/.htaccess`,
|
||||
`
|
||||
RewriteEngine On
|
||||
RewriteBase /
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteRule ^(.+)$ index.php [QSA,L]
|
||||
`
|
||||
);
|
||||
await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /app`);
|
||||
await saveBuildLog({
|
||||
line: 'Copied default configuration file for PHP.',
|
||||
|
@ -1,23 +1,33 @@
|
||||
import { buildImage } from '$lib/docker';
|
||||
import { promises as fs } from 'fs';
|
||||
|
||||
const createDockerfile = async (data, image): Promise<void> => {
|
||||
const createDockerfile = async (data, image, htaccessFound): Promise<void> => {
|
||||
const { workdir, baseDirectory } = data;
|
||||
const Dockerfile: Array<string> = [];
|
||||
Dockerfile.push(`FROM ${image}`);
|
||||
Dockerfile.push(`LABEL coolify.image=true`);
|
||||
Dockerfile.push('WORKDIR /app');
|
||||
Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
|
||||
Dockerfile.push(`COPY /.htaccess .`);
|
||||
if (htaccessFound) {
|
||||
Dockerfile.push(`COPY .${baseDirectory || ''}/.htaccess ./`);
|
||||
}
|
||||
Dockerfile.push(`COPY /entrypoint.sh /opt/docker/provision/entrypoint.d/30-entrypoint.sh`);
|
||||
Dockerfile.push(`EXPOSE 80`);
|
||||
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
|
||||
};
|
||||
|
||||
export default async function (data) {
|
||||
const { workdir, baseDirectory } = data;
|
||||
try {
|
||||
const image = 'webdevops/php-nginx';
|
||||
await createDockerfile(data, image);
|
||||
let htaccessFound = false;
|
||||
try {
|
||||
const d = await fs.readFile(`${workdir}${baseDirectory || ''}/.htaccess`);
|
||||
htaccessFound = true;
|
||||
} catch (e) {
|
||||
//
|
||||
}
|
||||
const image = htaccessFound ? 'webdevops/php-apache' : 'webdevops/php-nginx';
|
||||
await createDockerfile(data, image, htaccessFound);
|
||||
await buildImage(data);
|
||||
} catch (error) {
|
||||
throw error;
|
||||
|
@ -24,7 +24,9 @@ export const post: RequestHandler = async (event) => {
|
||||
const config = {
|
||||
image: `${image}:${version}`,
|
||||
volume: `${id}-n8n:/root/.n8n`,
|
||||
environmentVariables: {}
|
||||
environmentVariables: {
|
||||
WEBHOOK_URL: `${service.fqdn}`
|
||||
}
|
||||
};
|
||||
if (serviceSecret.length > 0) {
|
||||
serviceSecret.forEach((secret) => {
|
||||
|
Loading…
Reference in New Issue
Block a user