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