Skip to content
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

Install stubs for tools missing arm64 support #841

Merged
merged 3 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +1 to +9
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do believe we should deprecate 💯 of these from our base image. We can do that in a follow on PR. None of these are critical to have in the base image, and it's easy enough for users to mitigate it in their downstream images. Since 2.x has many breaking changes, this would be the time, no?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@osterman The difficult one to remove is goofys, because we have commands s3 and s3fs (that work together to mount an S3 bucket as if it were a local disk) that depend on it. That was my motivation to restore these commands and add stubs. Do we want to remove s3 and s3fs as well?

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice.

exit 1