WIP - Persistent storage
This commit is contained in:
		| @@ -135,7 +135,7 @@ export async function copyBaseConfigurationFiles(buildPack, workdir, buildId, ap | |||||||
|         RewriteRule ^(.+)$ index.php [QSA,L] |         RewriteRule ^(.+)$ index.php [QSA,L] | ||||||
|         ` |         ` | ||||||
| 			); | 			); | ||||||
| 			await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R www-data /app`); | 			await fs.writeFile(`${workdir}/entrypoint.sh`, `chown -R 1000 /app`); | ||||||
| 			saveBuildLog({ line: 'Copied default configuration file for PHP.', buildId, applicationId }); | 			saveBuildLog({ line: 'Copied default configuration file for PHP.', buildId, applicationId }); | ||||||
| 		} else if (staticDeployments.includes(buildPack)) { | 		} else if (staticDeployments.includes(buildPack)) { | ||||||
| 			await fs.writeFile( | 			await fs.writeFile( | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ const createDockerfile = async (data, image): Promise<void> => { | |||||||
| 	Dockerfile.push('WORKDIR /app'); | 	Dockerfile.push('WORKDIR /app'); | ||||||
| 	Dockerfile.push(`COPY .${baseDirectory || ''} /app`); | 	Dockerfile.push(`COPY .${baseDirectory || ''} /app`); | ||||||
| 	Dockerfile.push(`COPY /.htaccess .`); | 	Dockerfile.push(`COPY /.htaccess .`); | ||||||
| 	Dockerfile.push(`COPY /entrypoint.sh /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')); | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -70,7 +70,9 @@ export default async function (job) { | |||||||
|  |  | ||||||
| 	let volumes = | 	let volumes = | ||||||
| 		persistentStorage?.map((storage) => { | 		persistentStorage?.map((storage) => { | ||||||
| 			return `${applicationId}-${storage.id}:${type !== 'docker' ? '/app/' : ''}${storage.path}`; | 			return `${applicationId}${storage.path.replace(/\//gi, '-')}:${ | ||||||
|  | 				type !== 'docker' ? '/app/' : '' | ||||||
|  | 			}${storage.path}`; | ||||||
| 		}) || []; | 		}) || []; | ||||||
| 	// Previews, we need to get the source branch and set subdomain | 	// Previews, we need to get the source branch and set subdomain | ||||||
| 	if (pullmergeRequestId) { | 	if (pullmergeRequestId) { | ||||||
|   | |||||||
| @@ -11,6 +11,9 @@ | |||||||
|  |  | ||||||
| 	async function saveStorage() { | 	async function saveStorage() { | ||||||
| 		try { | 		try { | ||||||
|  | 			storage.path = storage.path.startsWith('/') ? storage.path : `/${storage.path}`; | ||||||
|  | 			storage.path = storage.path.endsWith('/') ? storage.path.slice(0, -1) : storage.path; | ||||||
|  | 			storage.path.replace(/\/\//g, '/'); | ||||||
| 			await post(`/applications/${id}/storage.json`, { | 			await post(`/applications/${id}/storage.json`, { | ||||||
| 				path: storage.path | 				path: storage.path | ||||||
| 			}); | 			}); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Andras Bacsai
					Andras Bacsai