Skip to content

Commit

Permalink
Refactor build script
Browse files Browse the repository at this point in the history
  • Loading branch information
tomb1n0 committed Jul 16, 2024
1 parent c2ec197 commit de97f1f
Showing 1 changed file with 22 additions and 12 deletions.
34 changes: 22 additions & 12 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,26 @@
#
# You should check https://endoflife.date/ansible to consider which Python version is suitable.

docker build --build-arg ANSIBLE_VERSION=2.10.0 --build-arg BASE_IMAGE=alpine:3.13 . -t rareloop-local/ansible:2.10.0
docker build --build-arg ANSIBLE_VERSION=3.4.0 --build-arg BASE_IMAGE=alpine:3.15 . -t rareloop-local/ansible:3.4.0
docker build --build-arg ANSIBLE_VERSION=4.8.0 --build-arg BASE_IMAGE=alpine:3.15 . -t rareloop-local/ansible:4.8.0
docker build --build-arg ANSIBLE_VERSION=4.10.0 --build-arg BASE_IMAGE=alpine:3.15 . -t rareloop-local/ansible:4.10.0
docker build --build-arg ANSIBLE_VERSION=5.5.0 --build-arg BASE_IMAGE=alpine:3.16 . -t rareloop-local/ansible:5.5.0
docker build --build-arg ANSIBLE_VERSION=5.8.0 --build-arg BASE_IMAGE=alpine:3.16 . -t rareloop-local/ansible:5.8.0
docker build --build-arg ANSIBLE_VERSION=5.10.0 --build-arg BASE_IMAGE=alpine:3.16 . -t rareloop-local/ansible:5.10.0
docker build --build-arg ANSIBLE_VERSION=6.7.0 --build-arg BASE_IMAGE=alpine:3.16 . -t rareloop-local/ansible:6.7.0
docker build --build-arg ANSIBLE_VERSION=7.7.0 --build-arg BASE_IMAGE=alpine:3.18 . -t rareloop-local/ansible:7.7.0
docker build --build-arg ANSIBLE_VERSION=8.7.0 --build-arg BASE_IMAGE=alpine:3.18 . -t rareloop-local/ansible:8.7.0
docker build --build-arg ANSIBLE_VERSION=9.7.0 --build-arg BASE_IMAGE=alpine:3.20 . -t rareloop-local/ansible:9.7.0
docker build --build-arg ANSIBLE_VERSION=10.1.0 --build-arg BASE_IMAGE=alpine:3.20 . -t rareloop-local/ansible:10.1.0
# Using two parallel arrays to match up an ansible version to its base alpine image
# MacOS doesn't come with a high enough bash version to use bash associative arrays.
ANSIBLE_VERSIONS=("2.10.0" "3.4.0" "4.8.0" "4.10.0" "5.5.0" "5.8.0" "5.10.0" "6.7.0" "7.7.0" "8.7.0" "9.7.0" "10.1.0")
BASE_IMAGES=("alpine:3.13" "alpine:3.15" "alpine:3.15" "alpine:3.15" "alpine:3.16" "alpine:3.16" "alpine:3.16" "alpine:3.16" "alpine:3.18" "alpine:3.18" "alpine:3.20" "alpine:3.20")

LENGTH=${#ANSIBLE_VERSIONS[@]}

for (( i=0; i<${LENGTH}; i++ )); do
ANSIBLE_VERSION=${ANSIBLE_VERSIONS[$i]}
BASE_IMAGE=${BASE_IMAGES[$i]}

echo "=====================";
echo "Ansible Version: ${ANSIBLE_VERSION}";
echo "Base Image: ${BASE_IMAGE}";
echo "=====================";

docker build --build-arg ANSIBLE_VERSION="${ANSIBLE_VERSION}" --build-arg BASE_IMAGE="${BASE_IMAGE}" . -t rareloop-local/ansible:"${ANSIBLE_VERSION}"
docker run -it --rm rareloop-local/ansible:"${ANSIBLE_VERSION}" ansible --version

echo "";
echo "";
echo "";
done

0 comments on commit de97f1f

Please sign in to comment.