Skip to content

Instantly share code, notes, and snippets.

@sdesalas
Last active March 26, 2024 14:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save sdesalas/ace5704fba837cb9eabe1c773face575 to your computer and use it in GitHub Desktop.
Save sdesalas/ace5704fba837cb9eabe1c773face575 to your computer and use it in GitHub Desktop.
Install AWSCLIv2 in `docker:latest` alpine image for running docker-dn-docker depoyments in Gitlab
# `docker:latest` image uses base alpine linux
# This script allows installing awscliv2 which requires
# gcc buildtools (instead of default `musl` in alpine)
# https://stackoverflow.com/questions/60298619/awscli-version-2-on-alpine-linux
GLIBC_VER=2.31-r0
# install glibc compatibility for alpine
apk --no-cache add \
binutils \
jq \
curl \
&& curl -sL https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub -o /etc/apk/keys/sgerrand.rsa.pub \
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-${GLIBC_VER}.apk \
&& curl -sLO https://github.com/sgerrand/alpine-pkg-glibc/releases/download/${GLIBC_VER}/glibc-bin-${GLIBC_VER}.apk \
&& apk add --no-cache \
glibc-${GLIBC_VER}.apk \
glibc-bin-${GLIBC_VER}.apk \
&& curl -sL https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip -o awscliv2.zip \
&& unzip awscliv2.zip > /dev/null \
&& aws/install \
&& rm -rf \
awscliv2.zip \
aws \
/usr/local/aws-cli/v2/*/dist/aws_completer \
/usr/local/aws-cli/v2/*/dist/awscli/data/ac.index \
/usr/local/aws-cli/v2/*/dist/awscli/examples \
&& apk --no-cache del \
binutils \
&& rm glibc-${GLIBC_VER}.apk \
&& rm glibc-bin-${GLIBC_VER}.apk \
&& rm -rf /var/cache/apk/*
# Install LightsailCTL Plugin (https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-install-software)
curl https://s3.us-west-2.amazonaws.com/lightsailctl/latest/linux-amd64/lightsailctl -o /usr/local/bin/lightsailctl
chmod +x /usr/local/bin/lightsailctl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment