Skip to content

[Bug]: TARGETPLATFORM argument not always populated depending on container runtime during build #1462

@p4yl04d3r

Description

@p4yl04d3r

🐞 Bug Summary

Resolve multi-arch build issue with "docker build" not setting Argument "TARGETPLATFORM" like buildkit does with buildx does. Also, Podman 4.9.x does not populate "TARGETPLATFORM".


🧩 Affected Component

Select the area of the project impacted:

  • mcpgateway - API
  • mcpgateway - UI (admin panel)
  • mcpgateway.wrapper - stdio wrapper
  • Federation or Transports
  • [ x] CLI, Makefiles, or shell scripts
  • Container setup (Docker/Podman/Compose)
  • Other (explain below)

🔁 Steps to Reproduce

  1. make container-build with Podman .
  2. make container-build with docker without buildx installed on the build system.

🤔 Expected Behavior

What should have happened instead?
Successful container builds for amd64, s390x and arm64


📓 Logs / Error Output

Paste any relevant stack traces or logs here.
Step 10/42 : WORKDIR /app
---> Running in 8905b22bf7cf
---> Removed intermediate container 8905b22bf7cf
---> 92fbfce210d4
Step 11/42 : RUN if [ "$TARGETPLATFORM" = "linux/s390x" ]; then echo "Building for s390x."; echo "export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL='True'" > /etc/profile.d/use-openssl.sh; else echo "export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL='False'" > /etc/profile.d/use-openssl.sh; fi
---> Running in e4eadd6e3f10
/bin/bash: line 1: TARGETPLATFORM: unbound variable
The command '/bin/bash -euo pipefail -c if [ "$TARGETPLATFORM" = "linux/s390x" ]; then echo "Building for s390x."; echo "export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL='True'" > /etc/profile.d/use-openssl.sh; else echo "export GRPC_PYTHON_BUILD_SYSTEM_OPENSSL='False'" > /etc/profile.d/use-openssl.sh; fi' returned a non-zero code: 1
make: *** [Makefile:1923: container-build] Error 1

🧠 Environment Info

You can retrieve most of this from the /version endpoint.

Key Value
Version or commit v1.0.0
Runtime Python 3.11, Gunicorn
Platform / OS Ubuntu 24.04, macOS
Container Docker, Podman

🧩 Additional Context (optional)

Add any configuration details, flags, or related issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageIssues / Features awaiting triage

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions