This repository has been archived by the owner on Sep 15, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 92
/
test.sh
executable file
·48 lines (39 loc) · 2.01 KB
/
test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/bin/bash
set -e
BASE_DIR="$( cd "$(dirname "$0")" && pwd )"
DOLI_VER=${1}
PHP_VER=${2:-""}
rm -rf "${BASE_DIR}/docker-compose-links/" && mkdir "${BASE_DIR}/docker-compose-links"
# shellcheck disable=SC2044
for directory in $(find "${BASE_DIR}/images" -maxdepth 1 -mindepth 1 -type d -printf '%f\n'); do
dolibarrVersion=$(echo "${directory}" | cut -d\- -f1)
phpVersion=$(echo "${directory}" | cut -d\- -f2)
#dolibarrMajor=$(echo "${dolibarrVersion}" | cut -d. -f1)
phpMajor=$(echo "${phpVersion}" | cut -d. -f1)
ln -nfs "${BASE_DIR}/images/${directory}" "${BASE_DIR}/docker-compose-links/${directory}"
if [ "${phpMajor}" = "php7" ]; then
ln -nfs "${BASE_DIR}/images/${directory}" "${BASE_DIR}/docker-compose-links/${dolibarrVersion}"
fi
done
if which docker-compose > /dev/null; then
dockerComposeBin="docker-compose"
else
dockerComposeBin="docker compose"
fi
echo "Testing for:"
echo " - Dolibarr ${DOLI_VER}"
if [ "${PHP_VER}" = "" ]; then
echo " - PHP most recent"
echo "Building image ..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1> /dev/null 2>/dev/null
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron
DOLI_VERSION=${DOLI_VER} PHP_VERSION="" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down
else
echo " - PHP ${PHP_VER}"
echo "Building image ..."
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down 1> /dev/null
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" build web
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" up --force-recreate web cron
DOLI_VERSION=${DOLI_VER} PHP_VERSION="-php${PHP_VER}" $dockerComposeBin -f "${BASE_DIR}/docker-compose.yml" down
fi