From ebf826e2aaeb8923dcb041ea7caf434be8e8d4bd Mon Sep 17 00:00:00 2001 From: Robert Lange <robert.lange@uni-leipzig.de> Date: Mon, 4 Sep 2023 22:13:25 +0200 Subject: [PATCH] refs #24469 [finc] composer docker addendum: make composer version configurable * also refs 23937 --- .env.local | 8 ++++- devops/docker/composer1/Dockerfile | 23 +++++++++++++ devops/docker/composer1/entrypoint.sh | 32 +++++++++++++++++++ .../docker/{composer => composer2}/Dockerfile | 0 .../{composer => composer2}/entrypoint.sh | 0 docker-compose.yml | 8 ++--- 6 files changed, 66 insertions(+), 5 deletions(-) create mode 100644 devops/docker/composer1/Dockerfile create mode 100755 devops/docker/composer1/entrypoint.sh rename devops/docker/{composer => composer2}/Dockerfile (100%) rename devops/docker/{composer => composer2}/entrypoint.sh (100%) diff --git a/.env.local b/.env.local index 73e059189ec..f90611cf1ea 100644 --- a/.env.local +++ b/.env.local @@ -1,4 +1,10 @@ +# Dependencies for grunt task (scss => css) GRUNT_SASS=^3.1.0 JIT_GRUNT=^0.10.0 NODE_SASS=^7.0.1 -PHPVERSION=php7_2 \ No newline at end of file + +# Dependencies for composer task (loads files for vendor) +COMPOSER_VERSION=composer2 + +# Version for php in PHP container +PHP_VERSION=php7_2 \ No newline at end of file diff --git a/devops/docker/composer1/Dockerfile b/devops/docker/composer1/Dockerfile new file mode 100644 index 00000000000..6bb77fbecc8 --- /dev/null +++ b/devops/docker/composer1/Dockerfile @@ -0,0 +1,23 @@ +# Copyright (C) 2020 Leipzig University Library +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author Sebastian Kehr <kehr@ub.uni-leipzig.de> +# @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3 + +FROM composer:1.9.3 +RUN apk add --no-cache freetype-dev libxml2-dev icu-dev \ + && docker-php-ext-install gd \ + && docker-php-ext-install soap \ + && docker-php-ext-install intl \ No newline at end of file diff --git a/devops/docker/composer1/entrypoint.sh b/devops/docker/composer1/entrypoint.sh new file mode 100755 index 00000000000..2be4334579f --- /dev/null +++ b/devops/docker/composer1/entrypoint.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env sh +# Copyright (C) 2020 Leipzig University Library +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# @author Sebastian Kehr <kehr@ub.uni-leipzig.de> +# @license https://opensource.org/licenses/GPL-3.0 GNU GPLv3 + +if [ "$(whoami)" = "php" ]; then + mkdir -p "$COMPOSER_HOME" + exec /docker-entrypoint.sh "$@" + exit +fi + +until ! (ping -c1 env >/dev/null 2>&1) && [ -f ./data/docker/env/composer ]; do :; done +set -a; . ./data/docker/env/composer; set +a + +: "${UIDGID:=$(stat -c '%u' .):$(stat -c '%g' .)}" +echo "php:x:$UIDGID:php:$(pwd):/bin/sh" >> /etc/passwd +chown "$UIDGID" "$(command -v composer)" +su -p -c "exec $0 $*" php \ No newline at end of file diff --git a/devops/docker/composer/Dockerfile b/devops/docker/composer2/Dockerfile similarity index 100% rename from devops/docker/composer/Dockerfile rename to devops/docker/composer2/Dockerfile diff --git a/devops/docker/composer/entrypoint.sh b/devops/docker/composer2/entrypoint.sh similarity index 100% rename from devops/docker/composer/entrypoint.sh rename to devops/docker/composer2/entrypoint.sh diff --git a/docker-compose.yml b/docker-compose.yml index 85b178f59b8..59aa7093ba1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,7 +9,7 @@ services: entrypoint: ["devops/docker/env/entrypoint.sh"] composer: - build: devops/docker/composer + build: devops/docker/${COMPOSER_VERSION:-composer1} working_dir: /usr/local/vufind volumes: - .:/usr/local/vufind:rw @@ -17,18 +17,18 @@ services: - $HOME/.ssh/known_hosts:/etc/ssh/ssh_known_hosts depends_on: - env - entrypoint: ["devops/docker/composer/entrypoint.sh"] + entrypoint: devops/docker/${COMPOSER_VERSION:-composer1}/entrypoint.sh command: ["install"] php: - build: devops/docker/${PHPVERSION:-php7_2} + build: devops/docker/${PHP_VERSION:-php7_2} working_dir: /usr/local/vufind volumes: - ./:/usr/local/vufind depends_on: - env - db - entrypoint: devops/docker/${PHPVERSION:-php7_2}/entrypoint.sh + entrypoint: devops/docker/${PHP_VERSION:-php7_2}/entrypoint.sh command: ["php-fpm"] httpd: -- GitLab