@@ -727,14 +727,26 @@ const parseGenerateOptions = (options: GenerateContainerfileOptions) => {
727727 baseInstructions,
728728 buildArgs,
729729 buildEnvVars,
730+ entrypointPrefix : options . image ?. entrypointPrefix ?? [ ] ,
730731 packages,
731732 postInstallCommands,
732733 } ;
733734} ;
734735
736+ function serializeEntrypoint ( entrypointPrefix : string [ ] , entrypoint : string ) {
737+ return JSON . stringify ( [ "dumb-init" , ...entrypointPrefix , "node" , entrypoint ] ) ;
738+ }
739+
735740async function generateBunContainerfile ( options : GenerateContainerfileOptions ) {
736- const { baseImage, buildArgs, buildEnvVars, postInstallCommands, baseInstructions, packages } =
737- parseGenerateOptions ( options ) ;
741+ const {
742+ baseImage,
743+ buildArgs,
744+ buildEnvVars,
745+ entrypointPrefix,
746+ postInstallCommands,
747+ baseInstructions,
748+ packages,
749+ } = parseGenerateOptions ( options ) ;
738750
739751 return `# syntax=docker/dockerfile:1
740752# check=skip=SecretsUsedInArgOrEnv
@@ -829,14 +841,21 @@ COPY --from=build --chown=bun:bun /app ./
829841# Copy the index.json file from the indexer stage
830842COPY --from=indexer --chown=bun:bun /app/index.json ./
831843
832- ENTRYPOINT [ "dumb-init", "node", " ${ options . entrypoint } " ]
844+ ENTRYPOINT ${ serializeEntrypoint ( entrypointPrefix , options . entrypoint ) }
833845CMD []
834846 ` ;
835847}
836848
837849async function generateNodeContainerfile ( options : GenerateContainerfileOptions ) {
838- const { baseImage, buildArgs, buildEnvVars, postInstallCommands, baseInstructions, packages } =
839- parseGenerateOptions ( options ) ;
850+ const {
851+ baseImage,
852+ buildArgs,
853+ buildEnvVars,
854+ entrypointPrefix,
855+ postInstallCommands,
856+ baseInstructions,
857+ packages,
858+ } = parseGenerateOptions ( options ) ;
840859
841860 return `# syntax=docker/dockerfile:1
842861# check=skip=SecretsUsedInArgOrEnv
@@ -939,7 +958,7 @@ COPY --from=build --chown=node:node /app ./
939958# Copy the index.json file from the indexer stage
940959COPY --from=indexer --chown=node:node /app/index.json ./
941960
942- ENTRYPOINT [ "dumb-init", "node", " ${ options . entrypoint } " ]
961+ ENTRYPOINT ${ serializeEntrypoint ( entrypointPrefix , options . entrypoint ) }
943962CMD []
944963 ` ;
945964}
0 commit comments