diff --git a/.env.local b/.env.local index 73e059189ec450e9a35a2fbde940ac7dfc48bc9c..f90611cf1ea5e479b938b22325f5ce25e429c6eb 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 0000000000000000000000000000000000000000..6bb77fbecc8f6704bf4c9f8724ac6ad3ff7d5909 --- /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 0000000000000000000000000000000000000000..2be4334579feb7885945cc8e1628595584fd55f3 --- /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 85b178f59b82dbee1565cc862243adae1a556795..59aa7093ba114d322946d0a83f834d6d277a58e0 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: