@@ -74,6 +74,10 @@ func BuildGatewayImages(config DockerBuildConfig) error {
7474 return err
7575 }
7676
77+ if err := ensurePythonExecutorInRuntimeContext (config .TempDir ); err != nil {
78+ return err
79+ }
80+
7781 fmt .Println (" ✓ Gateway-builder completed" )
7882
7983 // Step 2: Build the two images
@@ -121,6 +125,30 @@ func ensureBuildLockInControllerContext(tempDir string) error {
121125 return nil
122126}
123127
128+ // ensurePythonExecutorInRuntimeContext stages the python-executor directory
129+ // produced by gateway-builder into the gateway-runtime Docker build context
130+ // so the Dockerfile's `COPY python-executor/ ...` can resolve it.
131+ func ensurePythonExecutorInRuntimeContext (tempDir string ) error {
132+ pythonExecutorSrc := filepath .Join (tempDir , "output" , "python-executor" )
133+ if _ , err := os .Stat (pythonExecutorSrc ); err != nil {
134+ if errors .Is (err , os .ErrNotExist ) {
135+ return nil
136+ }
137+ return fmt .Errorf ("failed to access python-executor output: %w" , err )
138+ }
139+
140+ pythonExecutorDst := filepath .Join (tempDir , "output" , "gateway-runtime" , "python-executor" )
141+ if err := os .RemoveAll (pythonExecutorDst ); err != nil {
142+ return fmt .Errorf ("failed to clear existing python-executor in gateway-runtime build context: %w" , err )
143+ }
144+
145+ if err := utils .CopyDir (pythonExecutorSrc , pythonExecutorDst ); err != nil {
146+ return fmt .Errorf ("failed to copy python-executor into gateway-runtime build context: %w" , err )
147+ }
148+
149+ return nil
150+ }
151+
124152// runGatewayBuilder runs the gateway-builder container
125153func runGatewayBuilder (config DockerBuildConfig , logFile * os.File ) error {
126154 args := []string {"run" , "--rm" , "-v" , config .TempDir + ":/workspace" , config .GatewayBuilder ,
0 commit comments