Skip to content

Commit

Permalink
Install stubs for tools missing arm64 support (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru authored Apr 4, 2023
1 parent f6619d9 commit 99f5f07
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 10 deletions.
18 changes: 12 additions & 6 deletions os/alpine/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,19 @@ ENV KOPS_CLUSTER_NAME=example.foo.bar
USER root

# install the cloudposse alpine repository
ADD https://apk.cloudposse.com/[email protected] /etc/apk/keys/
RUN echo "@cloudposse https://apk.cloudposse.com/3.13/vendor" >> /etc/apk/repositories
RUN apk add --no-cache bash curl && \
curl -1sLf \
'https://dl.cloudsmith.io/public/cloudposse/packages/setup.alpine.sh' \
| bash && \
printf "@cloudposse %s\n\n" "$(grep -h -v '^[@#]' /etc/apk/repositories | grep -F "public/cloudposse/packages" | head -1)" \
>> /etc/apk/repositories

# Install the @community repo tag (community repo is already installed, but not tagged as @community)
RUN printf "@community %s\n" "$(grep -E 'alpine/v[^/]+/community' /etc/apk/repositories | head -1)" >> /etc/apk/repositories

# Install the @testing repo tag
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories

# Use TLS for alpine default repos
RUN sed -i 's|http://dl-cdn.alpinelinux.org|https://alpine.global.ssl.fastly.net|g' /etc/apk/repositories && \
echo "@testing https://alpine.global.ssl.fastly.net/alpine/edge/testing" >> /etc/apk/repositories && \
echo "@community https://alpine.global.ssl.fastly.net/alpine/edge/community" >> /etc/apk/repositories

##########################################################################################
# See Dockerfile.options for how to install `glibc` for greater compatibility, including #
Expand Down
14 changes: 13 additions & 1 deletion os/debian/Dockerfile.debian
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ USER root
# Keep dpkg quiet about running non-interactively
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

COPY packages.txt os/debian/packages-debian.txt /etc/apt/
COPY packages.txt packages-amd64-only.txt os/debian/packages-debian.txt /etc/apt/

## Here is where we would copy in the repo checksum in an attempt to ensure updates bust the Docker build cache

Expand Down Expand Up @@ -262,6 +262,18 @@ COPY os/debian/rootfs/ /

ARG TARGETARCH

# For certain pagkage we like to have but are not available on arm64,
# install them on amd64, and link to a stub script on arm64.
RUN if [ "$TARGETARCH" = "amd64" ]; then \
apt-get update && apt-get install -y \
$(grep -h -v '^#' /etc/apt/packages-amd64-only.txt | sed -E 's/@(cloudposse|community|testing)//g' ); \
else \
for pkg in $(grep -h -v '^#' /etc/apt/packages-amd64-only.txt | sed -E 's/@(cloudposse|community|testing)//g' ); do \
ln -s /usr/local/bin/no-arm64-support /usr/local/bin/$pkg; \
done; \
fi


# Move AWS CLI v1 aside and install AWS CLI v2 as default, leaving both available as alternatives.
# We do this at the end because we need cache busting from above to get us the latest AWS CLI v2

Expand Down
9 changes: 9 additions & 0 deletions packages-amd64-only.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# These are packages that are only supported on amd64,
# typically because they have not been updated since 2021.
awless@cloudposse
cfssl@cloudposse
emailcli@cloudposse
goofys@cloudposse
rakkess@cloudposse
tfenv@cloudposse
tfmask@cloudposse
6 changes: 3 additions & 3 deletions packages.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ direnv@community
dumb-init
emacs-nox
fetch@cloudposse
emailcli@cloudposse
# no arm64 emailcli@cloudposse
figlet
figurine@cloudposse
file
fuse
fzf@cloudposse
gettext
git
# no arm64 github-commenter@cloudposse
github-commenter@cloudposse
gomplate@cloudposse
goofys@cloudposse
#no arm64 support goofys@cloudposse
gosu@cloudposse
groff
helm@cloudposse
Expand Down
4 changes: 4 additions & 0 deletions rootfs/usr/local/bin/no-arm64-support
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

printf "$(tput setaf 1)%s is not supported on this platform (arm64)$(tput setaf 0)\n" "$(basename "$0")" >&2
exit 1

0 comments on commit 99f5f07

Please sign in to comment.