From 782639293b56b1cc29c03c8a6f7be821506e6eaa Mon Sep 17 00:00:00 2001 From: Michael Weber Date: Wed, 13 Aug 2025 13:42:06 -0400 Subject: [PATCH] Fixed support for arm based machines building the Docker container --- Dockerfile | 46 +++++++++++++++++++++++++++++++++++----------- 1 file changed, 35 insertions(+), 11 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6a0ab83..0a7820a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,14 +15,22 @@ RUN apt-get update && apt-get install -y \ python3-pip \ && rm -rf /var/lib/apt/lists/* -# Install Node.js and npm +# Install Node.js and npm (works for both architectures) RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ && apt-get install -y nodejs \ && npm install -g npm@latest -# Install Go +# Install Go with architecture detection RUN GO_VERSION=1.21.5 && \ - curl -fsSL https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o go.tar.gz && \ + ARCH=$(dpkg --print-architecture) && \ + if [ "$ARCH" = "amd64" ]; then \ + GO_ARCH="amd64"; \ + elif [ "$ARCH" = "arm64" ]; then \ + GO_ARCH="arm64"; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ + curl -fsSL https://golang.org/dl/go${GO_VERSION}.linux-${GO_ARCH}.tar.gz -o go.tar.gz && \ tar -C /usr/local -xzf go.tar.gz && \ rm go.tar.gz @@ -37,24 +45,40 @@ RUN mkdir -p $GOPATH/src $GOPATH/bin # Verify Go installation RUN go version -# Install .NET SDK directly from Microsoft +# Install .NET SDK with architecture detection RUN mkdir -p /usr/share/dotnet && \ + ARCH=$(dpkg --print-architecture) && \ + if [ "$ARCH" = "amd64" ]; then \ + DOTNET_ARCH="x64"; \ + elif [ "$ARCH" = "arm64" ]; then \ + DOTNET_ARCH="arm64"; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ curl -SL https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh -o dotnet-install.sh && \ chmod +x dotnet-install.sh && \ - ./dotnet-install.sh --channel 8.0 --install-dir /usr/share/dotnet && \ + ./dotnet-install.sh --channel 8.0 --install-dir /usr/share/dotnet --architecture $DOTNET_ARCH && \ ln -s /usr/share/dotnet/dotnet /usr/bin/dotnet && \ rm dotnet-install.sh # Verify .NET installation RUN dotnet --info -# Install AWS CLI -RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" \ - && unzip awscliv2.zip \ - && ./aws/install \ - && rm -rf aws awscliv2.zip +# Install AWS CLI with architecture detection +RUN ARCH=$(dpkg --print-architecture) && \ + if [ "$ARCH" = "amd64" ]; then \ + AWS_ARCH="x86_64"; \ + elif [ "$ARCH" = "arm64" ]; then \ + AWS_ARCH="aarch64"; \ + else \ + echo "Unsupported architecture: $ARCH" && exit 1; \ + fi && \ + curl "https://awscli.amazonaws.com/awscli-exe-linux-${AWS_ARCH}.zip" -o "awscliv2.zip" && \ + unzip awscliv2.zip && \ + ./aws/install && \ + rm -rf aws awscliv2.zip -# Install Terraform +# Install Terraform (HashiCorp repo supports both architectures automatically) RUN wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor | tee /usr/share/keyrings/hashicorp-archive-keyring.gpg \ && echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/hashicorp.list \ && apt-get update && apt-get install -y terraform