
Features:
- Rust support 🦀 (Thanks to @pepoviola)
- Add a default rewrite rule to PHP apps (to index.php)
- Able to control upgrades in a straightforward way
Fixes:
- Improved upgrade scripts
- Simplified prechecks before deployment
- Fixed path deployments
- Fixed already defined apps redirections
- Better error handling - still needs a lot of improvement here!
33 lines
1.3 KiB
JavaScript
33 lines
1.3 KiB
JavaScript
const fs = require('fs').promises
|
|
const { buildImage } = require('../helpers')
|
|
const { streamEvents, docker } = require('../../libs/docker')
|
|
|
|
// 'HEALTHCHECK --timeout=10s --start-period=10s --interval=5s CMD curl -I -s -f http://localhost/ || exit 1',
|
|
const publishStaticDocker = (configuration) => {
|
|
return [
|
|
'FROM nginx:stable-alpine',
|
|
'COPY nginx.conf /etc/nginx/nginx.conf',
|
|
'WORKDIR /usr/share/nginx/html',
|
|
configuration.build.command.build
|
|
? `COPY --from=${configuration.build.container.name}:${configuration.build.container.tag} /usr/src/app/${configuration.publish.directory} ./`
|
|
: `COPY ${configuration.build.directory} ./`,
|
|
'EXPOSE 80',
|
|
'CMD ["nginx", "-g", "daemon off;"]'
|
|
].join('\n')
|
|
}
|
|
|
|
module.exports = async function (configuration) {
|
|
try {
|
|
if (configuration.build.command.build) await buildImage(configuration)
|
|
await fs.writeFile(`${configuration.general.workdir}/Dockerfile`, publishStaticDocker(configuration))
|
|
|
|
const stream = await docker.engine.buildImage(
|
|
{ src: ['.'], context: configuration.general.workdir },
|
|
{ t: `${configuration.build.container.name}:${configuration.build.container.tag}` }
|
|
)
|
|
await streamEvents(stream, configuration)
|
|
} catch (error) {
|
|
throw { error, type: 'server' }
|
|
}
|
|
}
|