-
Notifications
You must be signed in to change notification settings - Fork 1
Docker images with arm64 support #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a42eac1
c56a12d
90cf858
b924c5d
a6b4203
344dd4d
445c7ab
b4982d7
ac6f856
a397ce7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,11 @@ | ||
FROM ubuntu:bionic | ||
|
||
ARG TARGETARCH | ||
|
||
RUN if [ "${TARGETARCH}" != "amd64" ] && [ "${TARGETARCH}" != "arm64" ]; then \ | ||
echo "${TARGETARCH} is not a supported architecture. Please use linux/amd64 or linux/arm64"; \ | ||
exit 1; fi | ||
|
||
RUN apt-get update && \ | ||
export DEBIAN_FRONTEND=noninteractive && \ | ||
apt-get install -y \ | ||
|
@@ -37,8 +43,8 @@ ENV DEBIAN_FRONTEND=noninteractive | |
RUN pip3 install --upgrade pip | ||
|
||
# Install AWS CLI v2 | ||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ | ||
unzip awscliv2.zip && \ | ||
RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-$(uname -m).zip" -o "awscliv2.zip" && \ | ||
jonyoder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
unzip -q awscliv2.zip && \ | ||
./aws/install && \ | ||
rm -rf awscliv2.zip aws | ||
|
||
|
@@ -50,28 +56,36 @@ RUN curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-c | |
RUN chmod +x /usr/local/bin/docker-compose | ||
|
||
# Install Go. Keep in sync with other Dockerfiles. | ||
ENV GOLANG_VERSION 1.17.1 | ||
ENV GOLANG_DOWNLOAD_SHA256 dab7d9c34361dc21ec237d584590d72500652e7c909bf082758fb63064fca0ef | ||
RUN curl -fsSL "https://dl.google.com/go/go${GOLANG_VERSION}.linux-amd64.tar.gz" -o golang.tar.gz \ | ||
ENV GOLANG_VERSION 1.18 | ||
RUN GOLANG_DOWNLOAD_SHA256=$(if [ $TARGETARCH = "arm64" ]; \ | ||
then echo "7ac7b396a691e588c5fb57687759e6c4db84a2a3bbebb0765f4b38e5b1c5b00e"; \ | ||
else echo "e85278e98f57cdb150fe8409e6e5df5343ecb13cebf03a5d5ff12bd55a80264f"; fi) \ | ||
Comment on lines
+61
to
+62
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From what I've seen this is (unfortunately) the idiomatic way to do platform-related logic in Dockerfiles. One note though; explicitly check for amd64, don't assume that arm64 and amd64 are the only possible architectures. |
||
&& curl -fsSL "https://dl.google.com/go/go${GOLANG_VERSION}.linux-${TARGETARCH}.tar.gz" -o golang.tar.gz \ | ||
&& echo "$GOLANG_DOWNLOAD_SHA256 golang.tar.gz" | sha256sum -c - \ | ||
&& tar -C /usr/local -xzf golang.tar.gz \ | ||
&& rm golang.tar.gz | ||
|
||
# Install Go tools | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go get -u \ | ||
golang.org/x/tools/... \ | ||
github.com/ramya-rao-a/go-outline \ | ||
github.com/fatih/gomodifytags \ | ||
github.com/josharian/impl \ | ||
github.com/haya14busa/goplay/cmd/goplay \ | ||
honnef.co/go/tools/cmd/staticcheck@latest \ | ||
github.com/uudashr/gopkgs/v2/cmd/gopkgs | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
golang.org/x/tools/...@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
github.com/ramya-rao-a/go-outline@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
github.com/fatih/gomodifytags@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
github.com/josharian/impl@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
github.com/haya14busa/goplay/cmd/goplay@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
honnef.co/go/tools/cmd/staticcheck@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
github.com/uudashr/gopkgs/v2/cmd/gopkgs@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" go install github.com/go-delve/delve/cmd/dlv@latest | ||
RUN GO111MODULE=on PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go get -v \ | ||
RUN GO111MODULE=on PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should GO111MODULE still be here? I thought it was removed in 1.18. |
||
golang.org/x/tools/gopls@latest | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools go install \ | ||
github.com/cweill/gotests/... | ||
RUN GO111MODULE=on PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools GOBIN=/tmp/ go get -v \ | ||
RUN PATH="$PATH:/usr/local/go/bin" GOPATH=/usr/local/gotools GOBIN=/tmp/ go install \ | ||
github.com/go-delve/delve/cmd/dlv@master && \ | ||
mv /tmp/dlv $GOPATH/bin/dlv-dap | ||
ENV PATH="$PATH:/usr/local/gotools/bin:/usr/local/go/bin" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't love this but realized while testing that waiting until the later build stages to discover a particular platform is unsupported is annoying. I couldn't find a built in mechanism to allowlist architectures but happy to hear better ideas.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm I've never thought about restricting architectures like this, but it does make sense.