Skip to content

Commit

Permalink
Merge branch 'master' of github.com:phase2/docker-cli
Browse files Browse the repository at this point in the history
  • Loading branch information
mike-potter committed Dec 6, 2024
2 parents 2541aff + c136e0b commit ddddf6f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
11 changes: 10 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,13 @@
set -ex

# Arguments: $1 CLI_VERSION
docker build --build-arg CLI_VERSION=php"${1:-8.0}" -t phase2/docker-cli:php"${1:-8.0}" ./src
CLI_VERSION=${1:-8.3}

# Install SQLite 3.x for Drupal 11 testing if CLI version >= 8.3
INSTALL_SQLITE=false
# Use the `bc` calculator to compare the PHP version number.
if [ "$(echo "${CLI_VERSION} >= 8.3" | bc -l)" -eq 1 ]; then
INSTALL_SQLITE=true
fi

docker build --build-arg CLI_VERSION=php"$CLI_VERSION" --build-arg INSTALL_SQLITE="$INSTALL_SQLITE" -t phase2/docker-cli:php"$CLI_VERSION" ./src
15 changes: 15 additions & 0 deletions src/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ FROM docksal/cli:${CLI_VERSION}
SHELL ["/bin/bash", "-o", "pipefail", "-c"]

ARG HELM_VERSION=v2.17.0
# Args defined before the FROM directive are not available in the build stage,
# so cannot test CLI_VERSION directly here.
ARG INSTALL_SQLITE=false

# Install kubectl and helm client
RUN curl -o /usr/local/bin/kubectl -LO "https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/$(dpkg --print-architecture)/kubectl" && \
Expand Down Expand Up @@ -39,6 +42,18 @@ RUN curl https://awscli.amazonaws.com/awscli-exe-linux-"$(uname -m)".zip -o "aws
RUN wget https://github.com/mikefarah/yq/releases/download/v4.21.1/yq_linux_"$(dpkg --print-architecture)".tar.gz -O - |\
tar xz && mv yq_linux_"$(dpkg --print-architecture)" /usr/bin/yq

# Upgrade SQLite 3.x if specified in the build args.
# @see https://www.drupal.org/project/drupal/issues/3346338
# @see https://github.com/docksal/service-cli/pull/327/files
# Need to get sqlite3 from the Debian testing repository as the default version is too old.
RUN if [ "$INSTALL_SQLITE" = "true" ]; then \
set -xe; \
echo "deb https://deb.debian.org/debian testing main" | tee /etc/apt/sources.list.d/testing.list; \
apt-get update >/dev/null; \
apt-get install -y -t testing sqlite3; \
apt-get clean; rm -rf /var/lib/apt/lists/*; \
fi

# Install expect, vim
RUN apt-get clean && \
apt update && \
Expand Down

0 comments on commit ddddf6f

Please sign in to comment.