Add support for php 8.1

This commit adds optional support for basing images on php 8.1 as
opposed to php 8.0.
This commit is contained in:
Tom Wiesing 2023-06-29 11:05:40 +02:00 committed by Tom
parent 3ef9c23a0c
commit d114c8fafe
12 changed files with 91 additions and 9 deletions

View file

@ -6,4 +6,5 @@ WISSKI_HOSTNAME=${HOSTNAME}
HOST_RULE=${HOST_RULE}
DOCKER_NETWORK_NAME=${DOCKER_NETWORK_NAME}
HTTPS_ENABLED=${HTTPS_ENABLED}
HTTPS_ENABLED=${HTTPS_ENABLED}
BARREL_BASE_IMAGE=${BARREL_BASE_IMAGE}

View file

@ -1,4 +1,5 @@
FROM docker.io/library/php:8.0-apache-bullseye
ARG BARREL_BASE_IMAGE
FROM $BARREL_BASE_IMAGE
ARG COMPOSER_VERSION=2.3.8
WORKDIR /var/www

View file

@ -2,7 +2,11 @@ version: "3.7"
services:
barrel:
build: .
build:
context: .
args:
BARREL_BASE_IMAGE: ${BARREL_BASE_IMAGE}
restart: always
hostname: ${WISSKI_HOSTNAME}

View file

@ -85,6 +85,18 @@ function composer_install_and_enable() {
done
}
function try_variants() {
for var in "$@"
do
if composer require --dry-run "$var" > /dev/null 2>&1; then
composer require "$var"
return 0;
fi
done
return 1;
}
# Create a new composer project.
log_info " => Creating composer project"
@ -99,7 +111,7 @@ composer --no-interaction config allow-plugins true
# Install drush so that we can automate a lot of things
log_info " => Installing 'drush'"
composer require drush/drush
try_variants 'drush/drush' 'drush/drush:^12' 'drush/drush:^11' || (echo "No version of Drush is installable" && false)
# Use 'drush' to run the site-installation.
# Here we need to use the username, password and database creds we made above.

View file

@ -31,6 +31,8 @@ func (barrel *Barrel) Stack() component.StackWithResources {
"DATA_PATH": filepath.Join(barrel.FilesystemBase, "data"),
"RUNTIME_DIR": barrel.Malt.Config.Paths.RuntimeDir(),
"BARREL_BASE_IMAGE": barrel.DockerBaseImage,
},
MakeDirs: []string{"data", ".composer"},