WIP Persistent storage

This commit is contained in:
Andras Bacsai 2022-03-21 16:58:13 +01:00
parent 2320ab0dfc
commit c013764b61
4 changed files with 12 additions and 9 deletions

View File

@ -4,7 +4,7 @@
"version": "2.0.31",
"license": "AGPL-3.0",
"scripts": {
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev --host 0.0.0.0",
"dev": "docker-compose -f docker-compose-dev.yaml up -d && NODE_ENV=development svelte-kit dev",
"dev:stop": "docker-compose -f docker-compose-dev.yaml down",
"dev:logs": "docker-compose -f docker-compose-dev.yaml logs -f --tail 10",
"studio": "npx prisma studio",

View File

@ -135,6 +135,7 @@ export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, ap
RewriteRule ^(.+)$ index.php [QSA,L]
`
);
await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R www-data /app`);
saveBuildLog({ line: 'Copied default configuration file for PHP.', buildId, applicationId });
} else if (staticDeployments.includes(buildPack)) {
await fs.writeFile(

View File

@ -13,19 +13,21 @@ const createDockerfile = async (data, image): Promise<void> => {
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`);
Dockerfile.push(`COPY /.htaccess /var/www/html/.htaccess`);
// Dockerfile.push('RUN a2enmod rewrite');
// Dockerfile.push(`ENV APACHE_DOCUMENT_ROOT /app`);
// Dockerfile.push(`RUN sed -ri -e 's!/var/www/html!/app!g' /etc/apache2/sites-available/*.conf`);
// Dockerfile.push(`RUN sed -ri -e 's!/var/www/!/app!g' /etc/apache2/apache2.conf /etc/apache2/conf-available/*.conf`)
Dockerfile.push('WORKDIR /app');
Dockerfile.push(`COPY .${baseDirectory || ''} /app`);
Dockerfile.push(`COPY /.htaccess .`);
Dockerfile.push(`COPY /entrypoint.sh /entrypoint.sh`);
Dockerfile.push(`EXPOSE 80`);
Dockerfile.push('CMD ["apache2-foreground"]');
Dockerfile.push('RUN chown -R www-data /var/www/html');
await fs.writeFile(`${workdir}/Dockerfile`, Dockerfile.join('\n'));
};
export default async function (data) {
try {
const image = 'php:apache';
const image = 'webdevops/php-nginx';
await createDockerfile(data, image);
await buildImage(data);
} catch (error) {

View File

@ -272,7 +272,7 @@ export default async function (job) {
`DOCKER_HOST=${host} docker run ${envFound && `--env-file=${workdir}/.env`} ${labels.join(
' '
)} --name ${imageId} --network ${docker.network} --restart always ${
volumes.length > 0 && volumes
volumes.length > 0 ? volumes : ''
} -d ${applicationId}:${tag}`
);
if (stderr) console.log(stderr);