Skip to content

Commit e6d55af

Browse files
committed
Fix handling of SQLite build argument
1 parent d0e383a commit e6d55af

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

build.sh

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@
33
set -ex
44

55
# Arguments: $1 CLI_VERSION
6-
docker build --build-arg CLI_VERSION=php"${1:-8.0}" -t phase2/docker-cli:php"${1:-8.0}" ./src
6+
CLI_VERSION=${1:-8.3}
7+
8+
# Install SQLite 3.x for Drupal 11 testing if CLI version >= 8.3
9+
INSTALL_SQLITE=false
10+
if [ "$(echo "${CLI_VERSION} >= 8.3" | bc -l)" -eq 1 ]; then
11+
INSTALL_SQLITE=true
12+
fi
13+
14+
docker build --build-arg CLI_VERSION=php"$CLI_VERSION" --build-arg INSTALL_SQLITE="$INSTALL_SQLITE" -t phase2/docker-cli:php"$CLI_VERSION" ./src

src/Dockerfile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ FROM docksal/cli:${CLI_VERSION}
77
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
88

99
ARG HELM_VERSION=v2.17.0
10+
# Args defined before the FROM directive are not available in the build stage.
11+
ARG INSTALL_SQLITE=false
1012

1113
# Install kubectl and helm client
1214
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" && \
@@ -44,12 +46,11 @@ RUN wget https://github.com/mikefarah/yq/releases/download/v4.21.1/yq_linux_"$(d
4446
# @see https://github.com/docksal/service-cli/pull/327/files
4547
# Use the `bc` calculator to compare the PHP version number, removing the `php` prefix.
4648
# Need to get sqlite3 from the Debian testing repository as the default version is too old.
47-
RUN if [ "$(echo "${CLI_VERSION#php} >= 8.3" | bc -l)" -eq 1 ]; then \
49+
RUN if [ "$INSTALL_SQLITE" = "true" ]; then \
4850
set -xe; \
4951
echo "deb https://deb.debian.org/debian testing main" | tee /etc/apt/sources.list.d/testing.list; \
5052
apt-get update >/dev/null; \
5153
apt-get install -y -t testing sqlite3; \
52-
# Cleanup
5354
apt-get clean; rm -rf /var/lib/apt/lists/*; \
5455
fi
5556

0 commit comments

Comments
 (0)