diff --git a/Dockerfile b/Dockerfile index 826bf06..a9b12f1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,7 +2,6 @@ FROM registry.opensuse.org/isv/rancher/harvester/os/dev/main/baseos:latest AS ba ARG CACHEBUST -ARG ARCH=amd64 # elemental init first RUN elemental init --force @@ -28,6 +27,15 @@ RUN cat /tmp/os-release >> /usr/lib/os-release && rm -f /tmp/os-release # Remove /etc/cos/config to use default values RUN rm -f /etc/cos/config +ARG TARGETPLATFORM + +RUN if [ "$TARGETPLATFORM" != "linux/amd64" ] && [ "$TARGETPLATFORM" != "linux/arm64" ]; then \ + echo "Error: Unsupported TARGETPLATFORM: $TARGETPLATFORM" && \ + exit 1; \ + fi + +ENV ARCH=${TARGETPLATFORM#linux/} + # Download rancherd ARG RANCHERD_VERSION=v0.2.0-rc1 RUN curl -o /usr/bin/rancherd -sfL "https://github.com/rancher/rancherd/releases/download/${RANCHERD_VERSION}/rancherd-${ARCH}" && chmod 0755 /usr/bin/rancherd