@@ -9,7 +9,7 @@ import { logger } from "../../logger";
99import { castErrorCause } from "./events" ;
1010import {
1111 convertToConfigBundle ,
12- getContainerOptions ,
12+ getContainerDevOptions ,
1313 LocalRuntimeController ,
1414} from "./LocalRuntimeController" ;
1515import { convertCfWorkerInitBindingsToBindings } from "./utils" ;
@@ -137,21 +137,27 @@ export class MultiworkerRuntimeController extends LocalRuntimeController {
137137 ) ;
138138 }
139139
140- // Assemble container options and build if necessary
141- const containerOptions = await getContainerOptions ( data . config ) ;
142- this . dockerPath = data . config . dev ?. dockerPath ?? getDockerPath ( ) ;
143- // keep track of them so we can clean up later
144- for ( const container of containerOptions ?? [ ] ) {
145- this . containerImageTagsSeen . add ( container . imageTag ) ;
146- }
147140 if (
148- containerOptions &&
141+ data . config . containers ?. length &&
149142 this . #currentContainerBuildId !== data . config . dev . containerBuildId
150143 ) {
151144 logger . log ( chalk . dim ( "⎔ Preparing container image(s)..." ) ) ;
145+ // Assemble container options and build if necessary
146+ assert (
147+ data . config . dev . containerBuildId ,
148+ "Build ID should be set if containers are enabled and defined"
149+ ) ;
150+ const containerOptions = await getContainerDevOptions (
151+ data . config . containers ,
152+ data . config . dev . containerBuildId
153+ ) ;
154+ this . dockerPath = data . config . dev ?. dockerPath ?? getDockerPath ( ) ;
155+ // keep track of them so we can clean up later
156+ for ( const container of containerOptions ?? [ ] ) {
157+ this . containerImageTagsSeen . add ( container . image_tag ) ;
158+ }
152159 await prepareContainerImagesForDev ( {
153160 dockerPath : this . dockerPath ,
154- configPath : data . config . config ,
155161 containerOptions,
156162 onContainerImagePreparationStart : ( buildStartEvent ) => {
157163 this . containerBeingBuilt = {
0 commit comments