Skip to content

Commit

Permalink
Support multi-arch environments (#185)
Browse files Browse the repository at this point in the history
* Support multi-arch installations

* Account for arm64 hardware platform definitions

* Multi-arch for dockerize

* Tests for machine-arm

* Correct for x86_64 machine types

* Correct for aarch64 machine types

---------

Co-authored-by: Kyle a.k.a. TechSquidTV <[email protected]>
  • Loading branch information
n-029894 and KyleTryon authored Sep 26, 2023
1 parent 06d0cd8 commit 98779bc
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 7 deletions.
9 changes: 5 additions & 4 deletions .circleci/test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ promotion_requires: &promotion_requires
test-macos-old,
test-machine-latest,
test-machine-old,
test-machine-arm,
test-build-command-workspace,
test-build-with-args,
test-build-bash-substitution
Expand Down Expand Up @@ -269,7 +270,7 @@ jobs:
- docker/install-docker-compose:
version: << parameters.docker-compose-version>>
install-dir: << parameters.install-dir>>

test-hadolint-install:
parameters:
executor:
Expand All @@ -280,7 +281,7 @@ jobs:
- docker/hadolint:
dockerfiles: test.Dockerfile
ignore-rules: DL4005,DL3008,DL3009,DL3015
trusted-registries: docker.io,my-company.com:5000
trusted-registries: docker.io,my-company.com:5000
- run:
name: Verifying hadolint install
command: |
Expand All @@ -305,7 +306,7 @@ workflows:
name: test-install-hadolint-<< matrix.executor >>
matrix:
parameters:
executor: [docker-latest, machine-arm, macos-latest]
executor: [docker-latest, machine-arm, macos-latest]
filters: *filters
- test-dockerlint:
name: dockerlint
Expand Down Expand Up @@ -595,7 +596,7 @@ workflows:
name: test-<< matrix.executor >>
matrix:
parameters:
executor: [macos-latest, macos-old]
executor: [macos-latest, macos-old, machine-arm]
install-goss: false
filters: *filters
# end test
Expand Down
8 changes: 7 additions & 1 deletion src/scripts/install-docker-compose.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,15 @@ else
PLATFORM=linux
fi

SYS_ARCH=$(uname -m)

if [ "$SYS_ARCH" == "arm64" ]; then
SYS_ARCH="aarch64"
fi

DOCKER_COMPOSE_BASE_URL="https://github.com/docker/compose/releases/download/$DOCKER_COMPOSE_VERSION"
DOCKER_COMPOSE_RELEASES_HTML="$(curl -Ls --fail --retry 3 "https://github.com/docker/compose/releases/tag/$DOCKER_COMPOSE_VERSION")"
DOCKER_COMPOSE_RELEASE="docker-compose-$PLATFORM-x86_64"
DOCKER_COMPOSE_RELEASE="docker-compose-$PLATFORM-$SYS_ARCH"
DOCKER_SHASUM_FILENAME="checksum.txt"

# since v2.10.0, docker-compose doesn't have a ".sha256" file
Expand Down
8 changes: 7 additions & 1 deletion src/scripts/install-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,13 @@ else
PLATFORM=linux
fi

DOCKER_BINARY_URL="https://download.docker.com/$PLATFORM/static/stable/x86_64/docker-$DOCKER_VERSION_NUMBER.tgz"
SYS_ARCH=$(uname -m)

if [ "$SYS_ARCH" == "arm64" ]; then
SYS_ARCH="aarch64"
fi

DOCKER_BINARY_URL="https://download.docker.com/$PLATFORM/static/stable/$SYS_ARCH/docker-$DOCKER_VERSION_NUMBER.tgz"

# download binary tarball
DOWNLOAD_DIR="$(mktemp -d)"
Expand Down
10 changes: 9 additions & 1 deletion src/scripts/install-dockerize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,15 @@ elif cat /etc/issue | grep Alpine &> /dev/null; then
PLATFORM=alpine-linux-amd64
apk add --no-cache openssl
else
PLATFORM=linux-amd64
SYS_ARCH=$(uname -m)

if [[ $SYS_ARCH == "x86_64" ]]; then
SYS_ARCH="amd64"
elif [[ $SYS_ARCH == "aarch64" ]]; then
SYS_ARCH="arm64"
fi

PLATFORM=linux-$SYS_ARCH
fi

DOCKERIZE_BINARY_URL="https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-$PLATFORM-$DOCKERIZE_VERSION.tar.gz"
Expand Down

0 comments on commit 98779bc

Please sign in to comment.