Conversation
Current docker file hardcodes compile platform to be AMD64. This leads to failed builds on ARM-based Macs. This PR switched target platform from static value to dynamic system var.
There was a problem hiding this comment.
Pull request overview
This PR aims to make the Dockerfile platform-agnostic by replacing the hardcoded linux/amd64 platform with a dynamic system variable. The change addresses build warnings and compatibility issues on ARM-based Macs.
Changes:
- Updated FROM statement to use
$BUILDPLATFORMinstead of hardcodedlinux/amd64
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Dockerfile
Outdated
| @@ -1,4 +1,4 @@ | |||
| FROM --platform=linux/amd64 python:3.12-slim | |||
| FROM --platform=$BUILDPLATFORM python:3.12-slim | |||
There was a problem hiding this comment.
Using BUILDPLATFORM here will build the image for the host platform (where the build is running), but this may not be the desired behavior. BUILDPLATFORM is typically used for build tools in multi-stage builds. For the final runtime image, you should use TARGETPLATFORM instead, which represents the platform you're building for. Alternatively, removing the --platform flag entirely will allow Docker to automatically use the appropriate platform.
| FROM --platform=$BUILDPLATFORM python:3.12-slim | |
| FROM --platform=$TARGETPLATFORM python:3.12-slim |
322a6dc to
c74c047
Compare
Current docker file hardcodes compile platform to be AMD64. This leads to failed builds on ARM-based Macs. This PR switched target platform from static value to dynamic system var.
This addresses the following warning message when running: