Adds a flag to the cli to override the entrypoint of a custom docker image. It could be used to reuse existing images with different eentrypoints.
Signed-off-by: Carlo Colombo <carlo.colombo@klarna.com>
This commit is contained in:
@@ -206,6 +206,10 @@ export function registerCommands(program: CommanderStatic) {
|
||||
'The mkdocs docker container to use',
|
||||
defaultDockerImage,
|
||||
)
|
||||
.option(
|
||||
'--docker-entrypoint <DOCKER_ENTRYPOINT>',
|
||||
'Override the image entrypoint',
|
||||
)
|
||||
.option(
|
||||
'--no-docker',
|
||||
'Do not use Docker, run `mkdocs serve` in current user environment.',
|
||||
@@ -224,6 +228,10 @@ export function registerCommands(program: CommanderStatic) {
|
||||
'The mkdocs docker container to use',
|
||||
defaultDockerImage,
|
||||
)
|
||||
.option(
|
||||
'--docker-entrypoint <DOCKER_ENTRYPOINT>',
|
||||
'Override the image entrypoint',
|
||||
)
|
||||
.option(
|
||||
'--no-docker',
|
||||
'Do not use Docker, use MkDocs executable in current user environment.',
|
||||
|
||||
@@ -61,6 +61,7 @@ export default async function serveMkdocs(cmd: Command) {
|
||||
const childProcess = await runMkdocsServer({
|
||||
port: cmd.port,
|
||||
dockerImage: cmd.dockerImage,
|
||||
dockerEntrypoint: cmd.dockerEntrypoint,
|
||||
useDocker: cmd.docker,
|
||||
stdoutLogFunc: logFunc,
|
||||
stderrLogFunc: logFunc,
|
||||
|
||||
@@ -90,6 +90,7 @@ export default async function serve(cmd: Command) {
|
||||
const mkdocsChildProcess = await runMkdocsServer({
|
||||
port: cmd.mkdocsPort,
|
||||
dockerImage: cmd.dockerImage,
|
||||
dockerEntrypoint: cmd.dockerEntrypoint,
|
||||
useDocker: cmd.docker,
|
||||
stdoutLogFunc: mkdocsLogFunc,
|
||||
stderrLogFunc: mkdocsLogFunc,
|
||||
|
||||
@@ -21,6 +21,7 @@ export const runMkdocsServer = async (options: {
|
||||
port?: string;
|
||||
useDocker?: boolean;
|
||||
dockerImage?: string;
|
||||
dockerEntrypoint?: string;
|
||||
stdoutLogFunc?: LogFunc;
|
||||
stderrLogFunc?: LogFunc;
|
||||
}): Promise<ChildProcess> => {
|
||||
@@ -41,6 +42,9 @@ export const runMkdocsServer = async (options: {
|
||||
'-p',
|
||||
`${port}:${port}`,
|
||||
'-it',
|
||||
...(options.dockerEntrypoint
|
||||
? ['--entrypoint', options.dockerEntrypoint]
|
||||
: []),
|
||||
dockerImage,
|
||||
'serve',
|
||||
'--dev-addr',
|
||||
|
||||
Reference in New Issue
Block a user