-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Features - Basic Python support # Fixes - Fix default start command
- Loading branch information
1 parent
adcd68c
commit c7efe89
Showing
12 changed files
with
225 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { docker, streamEvents } from '$lib/api/docker'; | ||
import { promises as fs } from 'fs'; | ||
// `HEALTHCHECK --timeout=10s --start-period=10s --interval=5s CMD curl -I -s -f http://localhost:${configuration.publish.port}${configuration.publish.path} || exit 1`, | ||
const publishPython = (configuration) => { | ||
return [ | ||
'FROM python:3-alpine', | ||
'WORKDIR /usr/src/app', | ||
'RUN pip install gunicorn', | ||
`COPY ./${configuration.build.directory}/requirements.txt ./`, | ||
`RUN pip install --no-cache-dir -r ./${configuration.build.directory}/requirements.txt`, | ||
`COPY ./${configuration.build.directory}/ .`, | ||
`EXPOSE ${configuration.publish.port}`, | ||
`CMD gunicorn -w=4 ${configuration.build.command.python.module}:${configuration.build.command.python.instance}` | ||
].join('\n'); | ||
}; | ||
|
||
export default async function (configuration) { | ||
await fs.writeFile( | ||
`${configuration.general.workdir}/Dockerfile`, | ||
publishPython(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); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.