@@ -43,13 +43,6 @@ def parse_args(args: List[str]) -> argparse.Namespace:
4343 parser .add_argument (
4444 "--tag" , type = str , default = "dev" , help = "Tag to apply to the built image (default: dev)"
4545 )
46- parser .add_argument (
47- "--platform" ,
48- type = str ,
49- choices = ["linux/amd64" , "linux/arm64" ],
50- default = "linux/amd64" ,
51- help = "Platform to build for (default: linux/amd64)" ,
52- )
5346 parser .add_argument (
5447 "--no-verify" , action = "store_true" , help = "Skip verification of the built image"
5548 )
@@ -178,15 +171,15 @@ def build_from_dockerfile(
178171 connector_dir : Path ,
179172 metadata : ConnectorMetadata ,
180173 tag : str ,
181- platform : str ,
174+ platforms : str = "linux/amd64,linux/arm64" ,
182175) -> str :
183176 """Build a Docker image for the connector using its Dockerfile.
184177
185178 Args:
186179 connector_dir: Path to the connector directory.
187180 metadata: The connector metadata.
188181 tag: The tag to apply to the built image.
189- platform : The platform to build for (e.g., linux/amd64).
182+ platforms : The platforms to build for (default: " linux/amd64,linux/arm64" ).
190183
191184 Returns:
192185 The full image name with tag.
@@ -202,22 +195,24 @@ def build_from_dockerfile(
202195 image_name = metadata .dockerRepository
203196 full_image_name = f"{ image_name } :{ tag } "
204197
205- logger .info (f"Building Docker image from Dockerfile: { full_image_name } for platform { platform } " )
198+ logger .info (f"Building Docker image from Dockerfile: { full_image_name } for platforms { platforms } " )
206199 logger .warning (
207200 "Building from Dockerfile is deprecated. Consider using a base image in metadata.yaml."
208201 )
209202
210203 build_cmd = [
211204 "docker" ,
205+ "buildx" ,
212206 "build" ,
213207 "--platform" ,
214- platform ,
208+ platforms ,
215209 "-t" ,
216210 full_image_name ,
217211 "--label" ,
218212 f"io.airbyte.version={ metadata .dockerImageTag } " ,
219213 "--label" ,
220214 f"io.airbyte.name={ metadata .dockerRepository } " ,
215+ "--load" , # Load the image into the local Docker daemon
221216 str (connector_dir ),
222217 ]
223218
@@ -234,15 +229,15 @@ def build_from_base_image(
234229 connector_dir : Path ,
235230 metadata : ConnectorMetadata ,
236231 tag : str ,
237- platform : str ,
232+ platforms : str = "linux/amd64,linux/arm64" ,
238233) -> str :
239234 """Build a Docker image for the connector using a base image.
240235
241236 Args:
242237 connector_dir: Path to the connector directory.
243238 metadata: The connector metadata.
244239 tag: The tag to apply to the built image.
245- platform : The platform to build for (e.g., linux/amd64).
240+ platforms : The platforms to build for (default: " linux/amd64,linux/arm64" ).
246241
247242 Returns:
248243 The full image name with tag.
@@ -259,7 +254,7 @@ def build_from_base_image(
259254 full_image_name = f"{ image_name } :{ tag } "
260255
261256 logger .info (
262- f"Building Docker image from base image { base_image } : { full_image_name } for platform { platform } "
257+ f"Building Docker image from base image { base_image } : { full_image_name } for platforms { platforms } "
263258 )
264259
265260 with tempfile .TemporaryDirectory () as temp_dir :
@@ -272,6 +267,8 @@ def build_from_base_image(
272267
273268COPY . .
274269
270+ RUN pip install .
271+
275272ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/{ get_main_file_name (connector_dir )} "
276273ENTRYPOINT ["python", "/airbyte/integration_code/{ get_main_file_name (connector_dir )} "]
277274"""
@@ -287,15 +284,17 @@ def build_from_base_image(
287284
288285 build_cmd = [
289286 "docker" ,
287+ "buildx" ,
290288 "build" ,
291289 "--platform" ,
292- platform ,
290+ platforms ,
293291 "-t" ,
294292 full_image_name ,
295293 "--label" ,
296294 f"io.airbyte.version={ metadata .dockerImageTag } " ,
297295 "--label" ,
298296 f"io.airbyte.name={ metadata .dockerRepository } " ,
297+ "--load" , # Load the image into the local Docker daemon
299298 str (temp_dir_path ),
300299 ]
301300
@@ -377,13 +376,16 @@ def run_command(args: List[str]) -> int:
377376 logger .info (f"Detected connector language: { language } " )
378377
379378 try :
379+ platforms = "linux/amd64,linux/arm64"
380+ logger .info (f"Building for platforms: { platforms } " )
381+
380382 if metadata .connectorBuildOptions and metadata .connectorBuildOptions .baseImage :
381383 image_name = build_from_base_image (
382- connector_dir , metadata , parsed_args .tag , parsed_args . platform
384+ connector_dir , metadata , parsed_args .tag , platforms
383385 )
384386 else :
385387 image_name = build_from_dockerfile (
386- connector_dir , metadata , parsed_args .tag , parsed_args . platform
388+ connector_dir , metadata , parsed_args .tag , platforms
387389 )
388390
389391 if not parsed_args .no_verify :
0 commit comments