diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..40852f8 --- /dev/null +++ b/Makefile @@ -0,0 +1,21 @@ +VERSION=3.2.0 +BUILD_NUMBER=20122001 + +build_vendor: + cd build \ + && ./build-vendor.sh \ + && cd .. + +build_version: + cd common \ + && VERSION=${VERSION} \ + BUILD_NUMBER=${BUILD_NUMBER} \ + ./build.sh env \ + && cd .. + +build_docker: + cd common \ + && VERSION=${VERSION} \ + BUILD_NUMBER=${BUILD_NUMBER} \ + ./build.sh docker \ + && cd .. diff --git a/common/build.sh b/common/build.sh index 3fdaf5c..aecabbe 100755 --- a/common/build.sh +++ b/common/build.sh @@ -1,9 +1,14 @@ #!/bin/bash +set -euo pipefail + BUILDS=`find ../ -type d -name sysPass-*` -BRANCH="master" -VERSION="3.1.2" -BUILD_NUMBER="19030701" +BRANCH="${VERSION:=master}" + +if [ -z "${VERSION}" ] || [ -z ${BUILD_NUMBER} ]; then + echo "ERROR: VERSION and BUILD_NUMBER must be set" + exit 1 +fi build_env() { for BUILD in ${BUILDS}; do @@ -11,7 +16,7 @@ build_env() { echo "Building env for ${TAG} (${BUILD})" - cp -af entrypoint.sh syspass.conf ${BUILD}/ + cp -af entrypoint.sh syspass.conf common_fn.sh ${BUILD}/ sed -i 's/SYSPASS_BRANCH="[a-z0-9\.]\+"/SYSPASS_BRANCH="'${BRANCH}'"/i; s/version=[a-z0-9\.\-]\+/version='${VERSION}'/i; diff --git a/sysPass-php7.2/entrypoint.sh b/common/common_fn.sh old mode 100755 new mode 100644 similarity index 53% rename from sysPass-php7.2/entrypoint.sh rename to common/common_fn.sh index 762b71b..ab6e728 --- a/sysPass-php7.2/entrypoint.sh +++ b/common/common_fn.sh @@ -1,20 +1,55 @@ -#!/bin/bash +: ${XDEBUG_REMOTE_HOST:="172.17.0.1"} +: ${XDEBUG_IDE_KEY:="ide"} +: ${SYSPASS_DEV:=0} +: ${PHP_XDEBUG_FILE:="/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"} +: ${SYSPASS_LOCALES:="es_ES en_US en_GB de_DE ca_ES fr_FR ru_RU pl_PL nl_NL pt_BR da_DK it_IT fo_FO ja_JP"} +: ${COMPOSER_EXTENSIONS:=} +: ${DEBUG:=0} + +if [ ${DEBUG} -eq 1 ]; then + set -x +fi + +COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +GOSU="gosu ${SYSPASS_UID}" COLOR_NC='\033[0m' COLOR_YELLOW='\033[0;33m' COLOR_RED='\033[0;31m' COLOR_GREEN='\033[0;32m' -XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST:-"172.17.0.1"} -XDEBUG_IDE_KEY=${XDEBUG_IDE_KEY:-"ide"} +if [ ${SYSPASS_DEV} -eq 1 ]; then + COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" +fi -COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +setup_apache () { + if [ ${SYSPASS_DEV} -eq 0 ]; then + return 0 + fi -GOSU="gosu ${SYSPASS_UID}" + echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" -if [ -e /usr/local/sbin/init-functions ]; then - . /usr/local/sbin/init-functions -fi + sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/; + s/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' \ + ${PHP_XDEBUG_FILE} +} + +run_apache () { + : ${PHP_INI_DIR:=} + + if [ -z "${PHP_INI_DIR}" ]; then + echo -e "${COLOR_YELLOW}run_apache: Starting Apache${COLOR_NC}" + + # Apache gets grumpy about PID files pre-existing + rm -f ${APACHE_PID_FILE} + + exec /usr/sbin/apache2ctl -DFOREGROUND + else + echo -e "${COLOR_YELLOW}run_apache: Starting Apache (PHP)${COLOR_NC}" + + apache2-foreground + fi +} setup_app () { if [ -e "${SYSPASS_DIR}/index.php" ]; then @@ -45,19 +80,10 @@ setup_locales() { echo -e "${COLOR_YELLOW}setup_locales: Setting up locales${COLOR_NC}" echo -e "\n### sysPass locales" >> $LOCALE_GEN - echo "es_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_US.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_GB.UTF-8 UTF-8" >> $LOCALE_GEN - echo "de_DE.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ca_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fr_FR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ru_RU.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pl_PL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "nl_NL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pt_BR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "da.UTF-8 UTF-8" >> $LOCALE_GEN - echo "it_IT.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fo.UTF-8 UTF-8" >> $LOCALE_GEN + + for LOCALE in ${SYSPASS_LOCALES}; do + echo "${LOCALE}.UTF-8 UTF-8" >> $LOCALE_GEN + done echo 'LANG="en_US.UTF-8"' > /etc/default/locale @@ -94,37 +120,3 @@ setup_composer_extensions () { run_composer require ${COMPOSER_EXTENSIONS} --update-no-dev fi } - -echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" -id ${SYSPASS_UID} > /dev/null 2>&1 || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user -export HOME=${SYSPASS_DIR} - -setup_app - -case "$1" in - "apache") - setup_composer_extensions - setup_locales - setup_apache - - SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) - - echo -e "${COLOR_GREEN}######" - echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation" - echo -e "######${COLOR_NC}" - echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" - - run_apache - ;; - "update") - run_composer update - ;; - "composer") - shift - run_composer "$@" - ;; - *) - echo -e "${COLOR_YELLOW}entrypoint: Starting $@${COLOR_NC}" - exec ${GOSU} "$@" - ;; -esac diff --git a/common/entrypoint.sh b/common/entrypoint.sh index 762b71b..2dd6df3 100755 --- a/common/entrypoint.sh +++ b/common/entrypoint.sh @@ -1,102 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash -COLOR_NC='\033[0m' -COLOR_YELLOW='\033[0;33m' -COLOR_RED='\033[0;31m' -COLOR_GREEN='\033[0;32m' +set -euo pipefail -XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST:-"172.17.0.1"} -XDEBUG_IDE_KEY=${XDEBUG_IDE_KEY:-"ide"} +COMMON_FN="common_fn.sh" -COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +source ${COMMON_FN} -GOSU="gosu ${SYSPASS_UID}" - -if [ -e /usr/local/sbin/init-functions ]; then - . /usr/local/sbin/init-functions -fi - -setup_app () { - if [ -e "${SYSPASS_DIR}/index.php" ]; then - echo -e "${COLOR_YELLOW}setup_app: Setting up permissions${COLOR_NC}" - - RW_DIRS="${SYSPASS_DIR}/app/config \ - ${SYSPASS_DIR}/app/backup \ - ${SYSPASS_DIR}/app/cache \ - ${SYSPASS_DIR}/app/resources \ - ${SYSPASS_DIR}/app/temp" - - chown ${APACHE_RUN_USER}:${SYSPASS_UID} -R ${RW_DIRS} - - chmod 750 ${RW_DIRS} - - chown ${SYSPASS_UID}:${SYSPASS_UID} -R \ - ${SYSPASS_DIR}/app/modules/*/plugins \ - ${SYSPASS_DIR}/composer.json \ - ${SYSPASS_DIR}/composer.lock \ - ${SYSPASS_DIR}/vendor - fi -} - -setup_locales() { - if [ ! -e ".setup" ]; then - LOCALE_GEN="/etc/locale.gen" - - echo -e "${COLOR_YELLOW}setup_locales: Setting up locales${COLOR_NC}" - - echo -e "\n### sysPass locales" >> $LOCALE_GEN - echo "es_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_US.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_GB.UTF-8 UTF-8" >> $LOCALE_GEN - echo "de_DE.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ca_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fr_FR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ru_RU.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pl_PL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "nl_NL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pt_BR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "da.UTF-8 UTF-8" >> $LOCALE_GEN - echo "it_IT.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fo.UTF-8 UTF-8" >> $LOCALE_GEN - - echo 'LANG="en_US.UTF-8"' > /etc/default/locale - - dpkg-reconfigure --frontend=noninteractive locales - - update-locale LANG=en_US.UTF-8 - - export LANG=en_US.UTF-8 - - echo "1" > .setup - else - echo -e "${COLOR_YELLOW}setup_locales: Locales already set up${COLOR_NC}" - fi -} - -run_composer () { - pushd ${SYSPASS_DIR} - - if [ -e "./composer.lock" -a -e "composer.json" ]; then - echo -e "${COLOR_YELLOW}run_composer: Running composer${COLOR_NC}" - - ${GOSU} composer "$@" ${COMPOSER_OPTIONS} - else - echo -e "${COLOR_RED}run_composer: Error, composer not set up${COLOR_NC}" - fi - - popd -} - -setup_composer_extensions () { - if [ -n "${COMPOSER_EXTENSIONS}" ]; then - echo -e "${COLOR_YELLOW}setup_composer_extensions: ${COMPOSER_EXTENSIONS}${COLOR_NC}" +echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" - run_composer require ${COMPOSER_EXTENSIONS} --update-no-dev - fi -} +id ${SYSPASS_UID} > /dev/null 2>&1 \ + || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user -echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" -id ${SYSPASS_UID} > /dev/null 2>&1 || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user export HOME=${SYSPASS_DIR} setup_app @@ -110,17 +24,28 @@ case "$1" in SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) echo -e "${COLOR_GREEN}######" - echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation" + echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation." echo -e "######${COLOR_NC}" echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" run_apache ;; "update") + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + run_composer update ;; "composer") shift + + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + run_composer "$@" ;; *) diff --git a/docker-compose.yml b/docker-compose.yml index 0e1f80b..19c7053 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,7 +2,7 @@ version: '2' services: app: container_name: syspass-app - image: syspass/syspass:3.1.2 + image: syspass/syspass:3.2.0 restart: always ports: - "80" diff --git a/sysPass-php7.0/Dockerfile b/sysPass-php7.0/Dockerfile deleted file mode 100644 index 04789ef..0000000 --- a/sysPass-php7.0/Dockerfile +++ /dev/null @@ -1,87 +0,0 @@ -# -# https://syspass.org -# https://doc.syspass.org -# -FROM composer:1.7 as bootstrap - -ENV SYSPASS_BRANCH="master" - -RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ - && composer install \ - --ignore-platform-reqs \ - --no-interaction \ - --no-plugins \ - --no-scripts \ - --prefer-dist \ - --no-dev \ - --classmap-authoritative \ - --working-dir /app/sysPass - -FROM debian:stretch as app - -LABEL maintainer=nuxsmin@syspass.org version=3.1.2 php=7.0 environment=production - -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get -y install \ - locales \ - apache2 \ - libapache2-mod-php7.0 \ - php-pear \ - php7.0 \ - php7.0-cgi \ - php7.0-cli \ - php7.0-common \ - php7.0-fpm \ - php7.0-gd \ - php7.0-json \ - php7.0-mysql \ - php7.0-readline \ - php7.0-curl \ - php7.0-intl \ - php7.0-ldap \ - php7.0-mcrypt \ - php7.0-xml \ - php7.0-mbstring \ - git \ - gosu \ - unzip \ - && apt-get clean \ - && rm -r /var/lib/apt/lists/* - -ENV APACHE_RUN_USER="www-data" \ - APACHE_RUN_GROUP="www-data" \ - APACHE_LOG_DIR="/var/log/apache2" \ - APACHE_LOCK_DIR="/var/lock/apache2" \ - APACHE_PID_FILE="/var/run/apache2.pid" \ - SYSPASS_DIR="/var/www/html/sysPass" \ - SYSPASS_UID=9001 - -WORKDIR /var/www/html - -LABEL build=19030701 - -# Custom sysPass Apache config with SSL by default -COPY ["syspass.conf", "/etc/apache2/sites-available/"] - -# Custom entrypoint -COPY entrypoint.sh init-functions /usr/local/sbin/ - -RUN chmod 755 /usr/local/sbin/entrypoint.sh \ - && a2dissite 000-default default-ssl \ - && a2ensite syspass \ - && a2enmod proxy_fcgi setenvif ssl rewrite \ - && a2enconf php7.0-fpm \ - && ln -sf /dev/stdout ${APACHE_LOG_DIR}/access.log \ - && ln -sf /dev/stderr ${APACHE_LOG_DIR}/error.log - -# sysPass dependencies -COPY --from=bootstrap /app/sysPass/ ${SYSPASS_DIR}/ - -# Composer binary -COPY --from=bootstrap /usr/bin/composer /usr/bin/ - -EXPOSE 80 443 - -ENTRYPOINT ["/usr/local/sbin/entrypoint.sh"] - -CMD ["apache"] diff --git a/sysPass-php7.0/docker-compose.yml b/sysPass-php7.0/docker-compose.yml deleted file mode 100644 index 93a5a11..0000000 --- a/sysPass-php7.0/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '2' -services: - app: - container_name: syspass-app - image: syspass/syspass:3.1.2 - restart: always - ports: - - "80" - - "443" - links: - - db - volumes: - - syspass-config:/var/www/html/sysPass/app/config - - syspass-backup:/var/www/html/sysPass/app/backup - db: - container_name: syspass-db - restart: always - image: mariadb:10.2 - environment: - - MYSQL_ROOT_PASSWORD=syspass - ports: - - "3306" - volumes: - - syspass-db:/var/lib/mysql - -volumes: - syspass-config: {} - syspass-backup: {} - syspass-db: {} diff --git a/sysPass-php7.0/init-functions b/sysPass-php7.0/init-functions deleted file mode 100644 index 1199008..0000000 --- a/sysPass-php7.0/init-functions +++ /dev/null @@ -1,10 +0,0 @@ -setup_apache () { - return 0 -} - -run_apache () { - # Apache gets grumpy about PID files pre-existing - rm -f ${APACHE_PID_FILE} - - exec /usr/sbin/apache2ctl -DFOREGROUND -} diff --git a/sysPass-php7.0_dev/docker-compose.yml b/sysPass-php7.0_dev/docker-compose.yml deleted file mode 100644 index bc86b7a..0000000 --- a/sysPass-php7.0_dev/docker-compose.yml +++ /dev/null @@ -1,29 +0,0 @@ -version: '2' -services: - app: - container_name: syspass-app - image: syspass/syspass:3.1.2-dev - restart: always - ports: - - "80" - - "443" - links: - - db - volumes: - - syspass-config:/var/www/html/sysPass/app/config - - syspass-backup:/var/www/html/sysPass/app/backup - db: - container_name: syspass-db - restart: always - image: mariadb:10.2 - environment: - - MYSQL_ROOT_PASSWORD=syspass - ports: - - "3306" - volumes: - - syspass-db:/var/lib/mysql - -volumes: - syspass-config: {} - syspass-backup: {} - syspass-db: {} diff --git a/sysPass-php7.0_dev/init-functions b/sysPass-php7.0_dev/init-functions deleted file mode 100644 index 94c7a79..0000000 --- a/sysPass-php7.0_dev/init-functions +++ /dev/null @@ -1,19 +0,0 @@ -if [ ${SYSPASS_DEV} -eq 1 ]; then - COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" -fi - -setup_apache () { - if [ ! -e "/etc/php/7.0/apache2/conf.d/20-xdebug.ini" -o ${SYSPASS_DEV} -eq 0 ]; then - return 0 - fi - - echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" - sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/; s/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' /etc/php/7.0/apache2/conf.d/20-xdebug.ini -} - -run_apache () { - # Apache gets grumpy about PID files pre-existing - rm -f ${APACHE_PID_FILE} - - exec /usr/sbin/apache2ctl -DFOREGROUND -} diff --git a/sysPass-php7.1/init-functions b/sysPass-php7.1/init-functions deleted file mode 100644 index e34a182..0000000 --- a/sysPass-php7.1/init-functions +++ /dev/null @@ -1,17 +0,0 @@ -if [ ${SYSPASS_DEV} -eq 1 ]; then - COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" -fi - -setup_apache () { - if [ ${SYSPASS_DEV} -eq 0 ]; then - return 0 - fi - - echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" - sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - sed -i 's/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -} - -run_apache () { - apache2-foreground -} diff --git a/sysPass-php7.1/syspass.conf b/sysPass-php7.1/syspass.conf deleted file mode 100644 index 2988abf..0000000 --- a/sysPass-php7.1/syspass.conf +++ /dev/null @@ -1,184 +0,0 @@ -RedirectMatch "^/$" "/index.php" - - - DirectoryIndex index.php - Options -Indexes -FollowSymLinks -Includes -ExecCGI - - - Require expr "%{REQUEST_URI} =~ m#.*/index\.php(\?r=)?#" - Require expr "%{REQUEST_URI} =~ m#.*/api\.php$#" - Require expr "%{REQUEST_URI} =~ m#^$#" - - - -# -# Require all granted -# - - - Require all granted - - - - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - #ServerName www.example.com - - ServerAdmin webmaster@localhost - DocumentRoot /var/www/html/sysPass - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - - RewriteEngine On - RewriteCond %{HTTPS} !=on - RewriteCond %{ENV:USE_SSL} "=yes" - RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] - - - - - - ServerAdmin webmaster@localhost - DocumentRoot /var/www/html/sysPass - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - # SSL Engine Switch: - # Enable/Disable SSL for this virtual host. - SSLEngine on - - # A self-signed (snakeoil) certificate can be created by installing - # the ssl-cert package. See - # /usr/share/doc/apache2/README.Debian.gz for more info. - # If both key and certificate are stored in the same file, only the - # SSLCertificateFile directive is needed. - SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem - SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key - - # Server Certificate Chain: - # Point SSLCertificateChainFile at a file containing the - # concatenation of PEM encoded CA certificates which form the - # certificate chain for the server certificate. Alternatively - # the referenced file can be the same as SSLCertificateFile - # when the CA certificates are directly appended to the server - # certificate for convinience. - #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt - - # Certificate Authority (CA): - # Set the CA certificate verification path where to find CA - # certificates for client authentication or alternatively one - # huge file containing all of them (file must be PEM encoded) - # Note: Inside SSLCACertificatePath you need hash symlinks - # to point to the certificate files. Use the provided - # Makefile to update the hash symlinks after changes. - #SSLCACertificatePath /etc/ssl/certs/ - #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt - - # Certificate Revocation Lists (CRL): - # Set the CA revocation path where to find CA CRLs for client - # authentication or alternatively one huge file containing all - # of them (file must be PEM encoded) - # Note: Inside SSLCARevocationPath you need hash symlinks - # to point to the certificate files. Use the provided - # Makefile to update the hash symlinks after changes. - #SSLCARevocationPath /etc/apache2/ssl.crl/ - #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl - - # Client Authentication (Type): - # Client certificate verification type and depth. Types are - # none, optional, require and optional_no_ca. Depth is a - # number which specifies how deeply to verify the certificate - # issuer chain before deciding the certificate is not valid. - #SSLVerifyClient require - #SSLVerifyDepth 10 - - # SSL Engine Options: - # Set various options for the SSL engine. - # o FakeBasicAuth: - # Translate the client X.509 into a Basic Authorisation. This means that - # the standard Auth/DBMAuth methods can be used for access control. The - # user name is the `one line' version of the client's X.509 certificate. - # Note that no password is obtained from the user. Every entry in the user - # file needs this password: `xxj31ZMTZzkVA'. - # o ExportCertData: - # This exports two additional environment variables: SSL_CLIENT_CERT and - # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the - # server (always existing) and the client (only existing when client - # authentication is used). This can be used to import the certificates - # into CGI scripts. - # o StdEnvVars: - # This exports the standard SSL/TLS related `SSL_*' environment variables. - # Per default this exportation is switched off for performance reasons, - # because the extraction step is an expensive operation and is usually - # useless for serving static content. So one usually enables the - # exportation for CGI and SSI requests only. - # o OptRenegotiate: - # This enables optimized SSL connection renegotiation handling when SSL - # directives are used in per-directory context. - #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire - - SSLOptions +StdEnvVars - - - SSLOptions +StdEnvVars - - - # SSL Protocol Adjustments: - # The safe and default but still SSL/TLS standard compliant shutdown - # approach is that mod_ssl sends the close notify alert but doesn't wait for - # the close notify alert from client. When you need a different shutdown - # approach you can use one of the following variables: - # o ssl-unclean-shutdown: - # This forces an unclean shutdown when the connection is closed, i.e. no - # SSL close notify alert is send or allowed to received. This violates - # the SSL/TLS standard but is needed for some brain-dead browsers. Use - # this when you receive I/O errors because of the standard approach where - # mod_ssl sends the close notify alert. - # o ssl-accurate-shutdown: - # This forces an accurate shutdown when the connection is closed, i.e. a - # SSL close notify alert is send and mod_ssl waits for the close notify - # alert of the client. This is 100% SSL/TLS standard compliant, but in - # practice often causes hanging connections with brain-dead browsers. Use - # this only for browsers where you know that their SSL implementation - # works correctly. - # Notice: Most problems of broken clients are also related to the HTTP - # keep-alive facility, so you usually additionally want to disable - # keep-alive for those clients, too. Use variable "nokeepalive" for this. - # Similarly, one has to force some clients to use HTTP/1.0 to workaround - # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and - # "force-response-1.0" for this. - BrowserMatch "MSIE [2-6]" \ - nokeepalive ssl-unclean-shutdown \ - downgrade-1.0 force-response-1.0 - # MSIE 7 and newer should be able to use keepalive - BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown - - - -# vim: syntax=apache ts=2 sw=2 sts=2 sr noet diff --git a/sysPass-php7.1/xdebug.ini b/sysPass-php7.1/xdebug.ini deleted file mode 100644 index 53bf972..0000000 --- a/sysPass-php7.1/xdebug.ini +++ /dev/null @@ -1,44 +0,0 @@ -; zend_extension=xdebug.so -zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so - -[debug] -; Remote settings -xdebug.remote_autostart=off -xdebug.remote_enable=on -xdebug.remote_handler=dbgp -xdebug.remote_mode=req -xdebug.remote_host=__XDEBUG_REMOTE_HOST__ -xdebug.remote_port=9000 -;xdebug.remote_log=/tmp/xdebug.log - -; General -xdebug.auto_trace=off -xdebug.collect_includes=on -xdebug.collect_params=off -xdebug.collect_return=off -xdebug.default_enable=on -xdebug.extended_info=1 -xdebug.manual_url=http://www.php.net -xdebug.show_local_vars=0 -xdebug.show_mem_delta=1 -xdebug.max_nesting_level=100 -xdebug.idekey=__XDEBUG_IDE_KEY__ -xdebug.force_display_errors=1 - -; Trace options -xdebug.trace_format=0 -xdebug.trace_output_dir=/tmp -xdebug.trace_options=0 -xdebug.trace_output_name=crc32 - -; Profiling -xdebug.profiler_append=1 -xdebug.profiler_enable=0 -xdebug.profiler_enable_trigger=1 -xdebug.profiler_output_dir=/tmp -xdebug.profiler_output_name=cachegring.out.%t -;xdebug.profiler_output_name=cachegring.out.%p -;xdebug.profiler_output_name=cachegring.out -;xdebug.profiler_output_name=cachegring.out.%R.%t - -xdebug.var_display_max_depth=5 diff --git a/sysPass-php7.2/Dockerfile b/sysPass-php7.2/Dockerfile deleted file mode 100644 index b6966bf..0000000 --- a/sysPass-php7.2/Dockerfile +++ /dev/null @@ -1,79 +0,0 @@ -# -# https://syspass.org -# https://doc.syspass.org -# - -FROM composer:1.7 as bootstrap - -ENV SYSPASS_BRANCH="master" - -RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ - && composer install \ - --ignore-platform-reqs \ - --no-interaction \ - --no-plugins \ - --no-scripts \ - --prefer-dist \ - --optimize-autoloader \ - --working-dir /app/sysPass - -FROM php:7.2-apache-stretch as app - -LABEL maintainer=nuxsmin@syspass.org version=3.1.2 php=7.2 - -RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get -y install \ - locales \ - git \ - gosu \ - libicu-dev \ - libldb-dev \ - libldap2-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libpng-dev \ - unzip \ - ssl-cert \ - && apt-get clean \ - && rm -r /var/lib/apt/lists/* \ - && pecl install xdebug-2.6.0 \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) ldap intl gettext pdo_mysql opcache gd \ - && docker-php-ext-enable ldap xdebug intl pdo_mysql - -ENV APACHE_RUN_USER="www-data" \ - SYSPASS_DIR="/var/www/html/sysPass" \ - SYSPASS_UID=9001 \ - SYSPASS_DEV=0 - -WORKDIR /var/www/html - -LABEL build=19030701 - -# Custom sysPass Apache config with SSL by default -COPY ["syspass.conf", "/etc/apache2/sites-available/"] - -# Xdebug module config -COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - -# Custom entrypoint -COPY entrypoint.sh init-functions /usr/local/sbin/ - -RUN chmod 755 /usr/local/sbin/entrypoint.sh \ - && a2dissite 000-default default-ssl \ - && a2ensite syspass \ - && a2enmod proxy_fcgi setenvif ssl rewrite \ - && ln -sf /dev/stdout ${APACHE_LOG_DIR}/access.log \ - && ln -sf /dev/stderr ${APACHE_LOG_DIR}/error.log - -# sysPass dependencies -COPY --from=bootstrap /app/sysPass/ ${SYSPASS_DIR}/ - -# Composer binary -COPY --from=bootstrap /usr/bin/composer /usr/bin/ - -EXPOSE 80 443 - -ENTRYPOINT ["/usr/local/sbin/entrypoint.sh"] - -CMD ["apache"] diff --git a/sysPass-php7.2/init-functions b/sysPass-php7.2/init-functions deleted file mode 100644 index e34a182..0000000 --- a/sysPass-php7.2/init-functions +++ /dev/null @@ -1,17 +0,0 @@ -if [ ${SYSPASS_DEV} -eq 1 ]; then - COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" -fi - -setup_apache () { - if [ ${SYSPASS_DEV} -eq 0 ]; then - return 0 - fi - - echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" - sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - sed -i 's/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -} - -run_apache () { - apache2-foreground -} diff --git a/sysPass-php7.2/syspass.conf b/sysPass-php7.2/syspass.conf deleted file mode 100644 index 2988abf..0000000 --- a/sysPass-php7.2/syspass.conf +++ /dev/null @@ -1,184 +0,0 @@ -RedirectMatch "^/$" "/index.php" - - - DirectoryIndex index.php - Options -Indexes -FollowSymLinks -Includes -ExecCGI - - - Require expr "%{REQUEST_URI} =~ m#.*/index\.php(\?r=)?#" - Require expr "%{REQUEST_URI} =~ m#.*/api\.php$#" - Require expr "%{REQUEST_URI} =~ m#^$#" - - - -# -# Require all granted -# - - - Require all granted - - - - # the server uses to identify itself. This is used when creating - # redirection URLs. In the context of virtual hosts, the ServerName - # specifies what hostname must appear in the request's Host: header to - # match this virtual host. For the default virtual host (this file) this - # value is not decisive as it is used as a last resort host regardless. - # However, you must set it for any further virtual host explicitly. - #ServerName www.example.com - - ServerAdmin webmaster@localhost - DocumentRoot /var/www/html/sysPass - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - - RewriteEngine On - RewriteCond %{HTTPS} !=on - RewriteCond %{ENV:USE_SSL} "=yes" - RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L] - - - - - - ServerAdmin webmaster@localhost - DocumentRoot /var/www/html/sysPass - - # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, - # error, crit, alert, emerg. - # It is also possible to configure the loglevel for particular - # modules, e.g. - #LogLevel info ssl:warn - - ErrorLog ${APACHE_LOG_DIR}/error.log - CustomLog ${APACHE_LOG_DIR}/access.log combined - - # For most configuration files from conf-available/, which are - # enabled or disabled at a global level, it is possible to - # include a line for only one particular virtual host. For example the - # following line enables the CGI configuration for this host only - # after it has been globally disabled with "a2disconf". - #Include conf-available/serve-cgi-bin.conf - - # SSL Engine Switch: - # Enable/Disable SSL for this virtual host. - SSLEngine on - - # A self-signed (snakeoil) certificate can be created by installing - # the ssl-cert package. See - # /usr/share/doc/apache2/README.Debian.gz for more info. - # If both key and certificate are stored in the same file, only the - # SSLCertificateFile directive is needed. - SSLCertificateFile /etc/ssl/certs/ssl-cert-snakeoil.pem - SSLCertificateKeyFile /etc/ssl/private/ssl-cert-snakeoil.key - - # Server Certificate Chain: - # Point SSLCertificateChainFile at a file containing the - # concatenation of PEM encoded CA certificates which form the - # certificate chain for the server certificate. Alternatively - # the referenced file can be the same as SSLCertificateFile - # when the CA certificates are directly appended to the server - # certificate for convinience. - #SSLCertificateChainFile /etc/apache2/ssl.crt/server-ca.crt - - # Certificate Authority (CA): - # Set the CA certificate verification path where to find CA - # certificates for client authentication or alternatively one - # huge file containing all of them (file must be PEM encoded) - # Note: Inside SSLCACertificatePath you need hash symlinks - # to point to the certificate files. Use the provided - # Makefile to update the hash symlinks after changes. - #SSLCACertificatePath /etc/ssl/certs/ - #SSLCACertificateFile /etc/apache2/ssl.crt/ca-bundle.crt - - # Certificate Revocation Lists (CRL): - # Set the CA revocation path where to find CA CRLs for client - # authentication or alternatively one huge file containing all - # of them (file must be PEM encoded) - # Note: Inside SSLCARevocationPath you need hash symlinks - # to point to the certificate files. Use the provided - # Makefile to update the hash symlinks after changes. - #SSLCARevocationPath /etc/apache2/ssl.crl/ - #SSLCARevocationFile /etc/apache2/ssl.crl/ca-bundle.crl - - # Client Authentication (Type): - # Client certificate verification type and depth. Types are - # none, optional, require and optional_no_ca. Depth is a - # number which specifies how deeply to verify the certificate - # issuer chain before deciding the certificate is not valid. - #SSLVerifyClient require - #SSLVerifyDepth 10 - - # SSL Engine Options: - # Set various options for the SSL engine. - # o FakeBasicAuth: - # Translate the client X.509 into a Basic Authorisation. This means that - # the standard Auth/DBMAuth methods can be used for access control. The - # user name is the `one line' version of the client's X.509 certificate. - # Note that no password is obtained from the user. Every entry in the user - # file needs this password: `xxj31ZMTZzkVA'. - # o ExportCertData: - # This exports two additional environment variables: SSL_CLIENT_CERT and - # SSL_SERVER_CERT. These contain the PEM-encoded certificates of the - # server (always existing) and the client (only existing when client - # authentication is used). This can be used to import the certificates - # into CGI scripts. - # o StdEnvVars: - # This exports the standard SSL/TLS related `SSL_*' environment variables. - # Per default this exportation is switched off for performance reasons, - # because the extraction step is an expensive operation and is usually - # useless for serving static content. So one usually enables the - # exportation for CGI and SSI requests only. - # o OptRenegotiate: - # This enables optimized SSL connection renegotiation handling when SSL - # directives are used in per-directory context. - #SSLOptions +FakeBasicAuth +ExportCertData +StrictRequire - - SSLOptions +StdEnvVars - - - SSLOptions +StdEnvVars - - - # SSL Protocol Adjustments: - # The safe and default but still SSL/TLS standard compliant shutdown - # approach is that mod_ssl sends the close notify alert but doesn't wait for - # the close notify alert from client. When you need a different shutdown - # approach you can use one of the following variables: - # o ssl-unclean-shutdown: - # This forces an unclean shutdown when the connection is closed, i.e. no - # SSL close notify alert is send or allowed to received. This violates - # the SSL/TLS standard but is needed for some brain-dead browsers. Use - # this when you receive I/O errors because of the standard approach where - # mod_ssl sends the close notify alert. - # o ssl-accurate-shutdown: - # This forces an accurate shutdown when the connection is closed, i.e. a - # SSL close notify alert is send and mod_ssl waits for the close notify - # alert of the client. This is 100% SSL/TLS standard compliant, but in - # practice often causes hanging connections with brain-dead browsers. Use - # this only for browsers where you know that their SSL implementation - # works correctly. - # Notice: Most problems of broken clients are also related to the HTTP - # keep-alive facility, so you usually additionally want to disable - # keep-alive for those clients, too. Use variable "nokeepalive" for this. - # Similarly, one has to force some clients to use HTTP/1.0 to workaround - # their broken HTTP/1.1 implementation. Use variables "downgrade-1.0" and - # "force-response-1.0" for this. - BrowserMatch "MSIE [2-6]" \ - nokeepalive ssl-unclean-shutdown \ - downgrade-1.0 force-response-1.0 - # MSIE 7 and newer should be able to use keepalive - BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown - - - -# vim: syntax=apache ts=2 sw=2 sts=2 sr noet diff --git a/sysPass-php7.3/Dockerfile b/sysPass-php7.3/Dockerfile index 375efc0..28210b8 100644 --- a/sysPass-php7.3/Dockerfile +++ b/sysPass-php7.3/Dockerfile @@ -2,67 +2,77 @@ # https://syspass.org # https://doc.syspass.org # +FROM composer:1.10 as bootstrap -FROM composer:1.7 as bootstrap +ENV SYSPASS_BRANCH="3.2.0" -ENV SYSPASS_BRANCH="master" - -RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ +RUN git clone --depth 1 --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ && composer install \ --ignore-platform-reqs \ --no-interaction \ --no-plugins \ --no-scripts \ --prefer-dist \ - --optimize-autoloader \ + --no-dev \ + --classmap-authoritative \ --working-dir /app/sysPass -FROM php:7.3-apache-stretch as app +FROM debian:buster as app -LABEL maintainer=nuxsmin@syspass.org version=3.1.2 php=7.3 +LABEL maintainer=nuxsmin@syspass.org version=3.2.0 php=7.3 environment=production RUN apt-get update \ - && apt-get install -y \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install \ locales \ + locales-all \ + apache2 \ + libapache2-mod-php7.3 \ + php-pear \ + php7.3 \ + php7.3-cgi \ + php7.3-cli \ + php7.3-common \ + php7.3-curl \ + php7.3-fpm \ + php7.3-gd \ + php7.3-intl \ + php7.3-json \ + php7.3-mbstring \ + php7.3-mysql \ + php7.3-opcache \ + php7.3-readline \ + php7.3-ldap \ + php7.3-xml \ + php7.3-zip \ git \ gosu \ - libicu-dev \ - libldb-dev \ - libldap2-dev \ - libfreetype6-dev \ - libjpeg62-turbo-dev \ - libpng-dev \ unzip \ - ssl-cert \ - && apt-get clean \ - && rm -r /var/lib/apt/lists/* \ - && pecl install xdebug-2.7.1 \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) ldap intl gettext pdo_mysql opcache gd \ - && docker-php-ext-enable ldap xdebug intl pdo_mysql + && apt-get clean \ + && rm -r /var/lib/apt/lists/* ENV APACHE_RUN_USER="www-data" \ + APACHE_RUN_GROUP="www-data" \ + APACHE_LOG_DIR="/var/log/apache2" \ + APACHE_LOCK_DIR="/var/lock/apache2" \ + APACHE_PID_FILE="/var/run/apache2.pid" \ SYSPASS_DIR="/var/www/html/sysPass" \ - SYSPASS_UID=9001 \ - SYSPASS_DEV=0 + SYSPASS_UID=9001 WORKDIR /var/www/html -LABEL build=19030701 +LABEL build=20122001 # Custom sysPass Apache config with SSL by default COPY ["syspass.conf", "/etc/apache2/sites-available/"] -# Xdebug module config -COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - # Custom entrypoint -COPY entrypoint.sh init-functions /usr/local/sbin/ +COPY entrypoint.sh common_fn.sh /usr/local/sbin/ RUN chmod 755 /usr/local/sbin/entrypoint.sh \ && a2dissite 000-default default-ssl \ && a2ensite syspass \ && a2enmod proxy_fcgi setenvif ssl rewrite \ + && a2enconf php7.3-fpm \ && ln -sf /dev/stdout ${APACHE_LOG_DIR}/access.log \ && ln -sf /dev/stderr ${APACHE_LOG_DIR}/error.log diff --git a/sysPass-php7.1/entrypoint.sh b/sysPass-php7.3/common_fn.sh old mode 100755 new mode 100644 similarity index 53% rename from sysPass-php7.1/entrypoint.sh rename to sysPass-php7.3/common_fn.sh index 762b71b..ab6e728 --- a/sysPass-php7.1/entrypoint.sh +++ b/sysPass-php7.3/common_fn.sh @@ -1,20 +1,55 @@ -#!/bin/bash +: ${XDEBUG_REMOTE_HOST:="172.17.0.1"} +: ${XDEBUG_IDE_KEY:="ide"} +: ${SYSPASS_DEV:=0} +: ${PHP_XDEBUG_FILE:="/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"} +: ${SYSPASS_LOCALES:="es_ES en_US en_GB de_DE ca_ES fr_FR ru_RU pl_PL nl_NL pt_BR da_DK it_IT fo_FO ja_JP"} +: ${COMPOSER_EXTENSIONS:=} +: ${DEBUG:=0} + +if [ ${DEBUG} -eq 1 ]; then + set -x +fi + +COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +GOSU="gosu ${SYSPASS_UID}" COLOR_NC='\033[0m' COLOR_YELLOW='\033[0;33m' COLOR_RED='\033[0;31m' COLOR_GREEN='\033[0;32m' -XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST:-"172.17.0.1"} -XDEBUG_IDE_KEY=${XDEBUG_IDE_KEY:-"ide"} +if [ ${SYSPASS_DEV} -eq 1 ]; then + COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" +fi -COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +setup_apache () { + if [ ${SYSPASS_DEV} -eq 0 ]; then + return 0 + fi -GOSU="gosu ${SYSPASS_UID}" + echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" -if [ -e /usr/local/sbin/init-functions ]; then - . /usr/local/sbin/init-functions -fi + sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/; + s/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' \ + ${PHP_XDEBUG_FILE} +} + +run_apache () { + : ${PHP_INI_DIR:=} + + if [ -z "${PHP_INI_DIR}" ]; then + echo -e "${COLOR_YELLOW}run_apache: Starting Apache${COLOR_NC}" + + # Apache gets grumpy about PID files pre-existing + rm -f ${APACHE_PID_FILE} + + exec /usr/sbin/apache2ctl -DFOREGROUND + else + echo -e "${COLOR_YELLOW}run_apache: Starting Apache (PHP)${COLOR_NC}" + + apache2-foreground + fi +} setup_app () { if [ -e "${SYSPASS_DIR}/index.php" ]; then @@ -45,19 +80,10 @@ setup_locales() { echo -e "${COLOR_YELLOW}setup_locales: Setting up locales${COLOR_NC}" echo -e "\n### sysPass locales" >> $LOCALE_GEN - echo "es_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_US.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_GB.UTF-8 UTF-8" >> $LOCALE_GEN - echo "de_DE.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ca_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fr_FR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ru_RU.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pl_PL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "nl_NL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pt_BR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "da.UTF-8 UTF-8" >> $LOCALE_GEN - echo "it_IT.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fo.UTF-8 UTF-8" >> $LOCALE_GEN + + for LOCALE in ${SYSPASS_LOCALES}; do + echo "${LOCALE}.UTF-8 UTF-8" >> $LOCALE_GEN + done echo 'LANG="en_US.UTF-8"' > /etc/default/locale @@ -94,37 +120,3 @@ setup_composer_extensions () { run_composer require ${COMPOSER_EXTENSIONS} --update-no-dev fi } - -echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" -id ${SYSPASS_UID} > /dev/null 2>&1 || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user -export HOME=${SYSPASS_DIR} - -setup_app - -case "$1" in - "apache") - setup_composer_extensions - setup_locales - setup_apache - - SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) - - echo -e "${COLOR_GREEN}######" - echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation" - echo -e "######${COLOR_NC}" - echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" - - run_apache - ;; - "update") - run_composer update - ;; - "composer") - shift - run_composer "$@" - ;; - *) - echo -e "${COLOR_YELLOW}entrypoint: Starting $@${COLOR_NC}" - exec ${GOSU} "$@" - ;; -esac diff --git a/sysPass-php7.3/docker-compose.yml b/sysPass-php7.3/docker-compose.yml index 83e7b16..3b2720a 100644 --- a/sysPass-php7.3/docker-compose.yml +++ b/sysPass-php7.3/docker-compose.yml @@ -2,7 +2,7 @@ version: '2' services: app: container_name: syspass-app - image: syspass/syspass:3.1.2-php7.3 + image: syspass/syspass:3.2.0-php7.3 restart: always ports: - "80" diff --git a/sysPass-php7.3/entrypoint.sh b/sysPass-php7.3/entrypoint.sh index 762b71b..2dd6df3 100755 --- a/sysPass-php7.3/entrypoint.sh +++ b/sysPass-php7.3/entrypoint.sh @@ -1,102 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash -COLOR_NC='\033[0m' -COLOR_YELLOW='\033[0;33m' -COLOR_RED='\033[0;31m' -COLOR_GREEN='\033[0;32m' +set -euo pipefail -XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST:-"172.17.0.1"} -XDEBUG_IDE_KEY=${XDEBUG_IDE_KEY:-"ide"} +COMMON_FN="common_fn.sh" -COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +source ${COMMON_FN} -GOSU="gosu ${SYSPASS_UID}" - -if [ -e /usr/local/sbin/init-functions ]; then - . /usr/local/sbin/init-functions -fi - -setup_app () { - if [ -e "${SYSPASS_DIR}/index.php" ]; then - echo -e "${COLOR_YELLOW}setup_app: Setting up permissions${COLOR_NC}" - - RW_DIRS="${SYSPASS_DIR}/app/config \ - ${SYSPASS_DIR}/app/backup \ - ${SYSPASS_DIR}/app/cache \ - ${SYSPASS_DIR}/app/resources \ - ${SYSPASS_DIR}/app/temp" - - chown ${APACHE_RUN_USER}:${SYSPASS_UID} -R ${RW_DIRS} - - chmod 750 ${RW_DIRS} - - chown ${SYSPASS_UID}:${SYSPASS_UID} -R \ - ${SYSPASS_DIR}/app/modules/*/plugins \ - ${SYSPASS_DIR}/composer.json \ - ${SYSPASS_DIR}/composer.lock \ - ${SYSPASS_DIR}/vendor - fi -} - -setup_locales() { - if [ ! -e ".setup" ]; then - LOCALE_GEN="/etc/locale.gen" - - echo -e "${COLOR_YELLOW}setup_locales: Setting up locales${COLOR_NC}" - - echo -e "\n### sysPass locales" >> $LOCALE_GEN - echo "es_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_US.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_GB.UTF-8 UTF-8" >> $LOCALE_GEN - echo "de_DE.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ca_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fr_FR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ru_RU.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pl_PL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "nl_NL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pt_BR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "da.UTF-8 UTF-8" >> $LOCALE_GEN - echo "it_IT.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fo.UTF-8 UTF-8" >> $LOCALE_GEN - - echo 'LANG="en_US.UTF-8"' > /etc/default/locale - - dpkg-reconfigure --frontend=noninteractive locales - - update-locale LANG=en_US.UTF-8 - - export LANG=en_US.UTF-8 - - echo "1" > .setup - else - echo -e "${COLOR_YELLOW}setup_locales: Locales already set up${COLOR_NC}" - fi -} - -run_composer () { - pushd ${SYSPASS_DIR} - - if [ -e "./composer.lock" -a -e "composer.json" ]; then - echo -e "${COLOR_YELLOW}run_composer: Running composer${COLOR_NC}" - - ${GOSU} composer "$@" ${COMPOSER_OPTIONS} - else - echo -e "${COLOR_RED}run_composer: Error, composer not set up${COLOR_NC}" - fi - - popd -} - -setup_composer_extensions () { - if [ -n "${COMPOSER_EXTENSIONS}" ]; then - echo -e "${COLOR_YELLOW}setup_composer_extensions: ${COMPOSER_EXTENSIONS}${COLOR_NC}" +echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" - run_composer require ${COMPOSER_EXTENSIONS} --update-no-dev - fi -} +id ${SYSPASS_UID} > /dev/null 2>&1 \ + || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user -echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" -id ${SYSPASS_UID} > /dev/null 2>&1 || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user export HOME=${SYSPASS_DIR} setup_app @@ -110,17 +24,28 @@ case "$1" in SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) echo -e "${COLOR_GREEN}######" - echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation" + echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation." echo -e "######${COLOR_NC}" echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" run_apache ;; "update") + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + run_composer update ;; "composer") shift + + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + run_composer "$@" ;; *) diff --git a/sysPass-php7.3/init-functions b/sysPass-php7.3/init-functions deleted file mode 100644 index e34a182..0000000 --- a/sysPass-php7.3/init-functions +++ /dev/null @@ -1,17 +0,0 @@ -if [ ${SYSPASS_DEV} -eq 1 ]; then - COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" -fi - -setup_apache () { - if [ ${SYSPASS_DEV} -eq 0 ]; then - return 0 - fi - - echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" - sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini - sed -i 's/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini -} - -run_apache () { - apache2-foreground -} diff --git a/sysPass-php7.3/xdebug.ini b/sysPass-php7.3/xdebug.ini deleted file mode 100644 index 53bf972..0000000 --- a/sysPass-php7.3/xdebug.ini +++ /dev/null @@ -1,44 +0,0 @@ -; zend_extension=xdebug.so -zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so - -[debug] -; Remote settings -xdebug.remote_autostart=off -xdebug.remote_enable=on -xdebug.remote_handler=dbgp -xdebug.remote_mode=req -xdebug.remote_host=__XDEBUG_REMOTE_HOST__ -xdebug.remote_port=9000 -;xdebug.remote_log=/tmp/xdebug.log - -; General -xdebug.auto_trace=off -xdebug.collect_includes=on -xdebug.collect_params=off -xdebug.collect_return=off -xdebug.default_enable=on -xdebug.extended_info=1 -xdebug.manual_url=http://www.php.net -xdebug.show_local_vars=0 -xdebug.show_mem_delta=1 -xdebug.max_nesting_level=100 -xdebug.idekey=__XDEBUG_IDE_KEY__ -xdebug.force_display_errors=1 - -; Trace options -xdebug.trace_format=0 -xdebug.trace_output_dir=/tmp -xdebug.trace_options=0 -xdebug.trace_output_name=crc32 - -; Profiling -xdebug.profiler_append=1 -xdebug.profiler_enable=0 -xdebug.profiler_enable_trigger=1 -xdebug.profiler_output_dir=/tmp -xdebug.profiler_output_name=cachegring.out.%t -;xdebug.profiler_output_name=cachegring.out.%p -;xdebug.profiler_output_name=cachegring.out -;xdebug.profiler_output_name=cachegring.out.%R.%t - -xdebug.var_display_max_depth=5 diff --git a/sysPass-php7.0_dev/20-xdebug.ini b/sysPass-php7.3_dev/20-xdebug.ini similarity index 100% rename from sysPass-php7.0_dev/20-xdebug.ini rename to sysPass-php7.3_dev/20-xdebug.ini diff --git a/sysPass-php7.0_dev/Dockerfile b/sysPass-php7.3_dev/Dockerfile similarity index 61% rename from sysPass-php7.0_dev/Dockerfile rename to sysPass-php7.3_dev/Dockerfile index fc61436..3edb11e 100644 --- a/sysPass-php7.0_dev/Dockerfile +++ b/sysPass-php7.3_dev/Dockerfile @@ -2,11 +2,11 @@ # https://syspass.org # https://doc.syspass.org # -FROM composer:1.7 as bootstrap +FROM composer:1.10 as bootstrap -ENV SYSPASS_BRANCH="master" +ENV SYSPASS_BRANCH="3.2.0" -RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ +RUN git clone --depth 1 --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ && composer install \ --ignore-platform-reqs \ --no-interaction \ @@ -16,32 +16,37 @@ RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git --optimize-autoloader \ --working-dir /app/sysPass -FROM debian:stretch as app +FROM debian:buster as app -LABEL maintainer=nuxsmin@syspass.org version=3.1.2 php=7.0 environment=debug +LABEL maintainer=nuxsmin@syspass.org version=3.2.0 php=7.3 environment=debug RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get -y install \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install \ locales \ + locales-all \ apache2 \ - libapache2-mod-php7.0 \ + libapache2-mod-php7.3 \ php-pear \ - php7.0 \ - php7.0-cgi \ - php7.0-cli \ - php7.0-common \ - php7.0-fpm \ - php7.0-gd \ - php7.0-json \ - php7.0-mysql \ - php7.0-readline \ - php7.0-curl \ - php7.0-intl \ - php7.0-ldap \ - php7.0-mcrypt \ - php7.0-xml \ - php7.0-mbstring \ - php7.0-xdebug \ + php7.3 \ + php7.3-cgi \ + php7.3-cli \ + php7.3-common \ + php7.3-curl \ + php7.3-fpm \ + php7.3-gd \ + php7.3-intl \ + php7.3-json \ + php7.3-mbstring \ + php7.3-mysql \ + php7.3-opcache \ + php7.3-readline \ + php7.3-ldap \ + php7.3-xdebug \ + php7.3-xml \ + php7.3-zip \ + git \ + gosu \ + unzip \ git \ gosu \ unzip \ @@ -59,22 +64,22 @@ ENV APACHE_RUN_USER="www-data" \ WORKDIR /var/www/html -LABEL build=19030701 +LABEL build=20122001 # Custom sysPass Apache config with SSL by default COPY ["syspass.conf", "/etc/apache2/sites-available/"] # Xdebug module config -COPY 20-xdebug.ini /etc/php/7.0/apache2/conf.d/20-xdebug.ini +COPY 20-xdebug.ini /etc/php/7.3/apache2/conf.d/20-xdebug.ini # Custom entrypoint -COPY entrypoint.sh init-functions /usr/local/sbin/ +COPY entrypoint.sh common_fn.sh /usr/local/sbin/ RUN chmod 755 /usr/local/sbin/entrypoint.sh \ && a2dissite 000-default default-ssl \ && a2ensite syspass \ && a2enmod proxy_fcgi setenvif ssl rewrite \ - && a2enconf php7.0-fpm \ + && a2enconf php7.3-fpm \ && ln -sf /dev/stdout ${APACHE_LOG_DIR}/access.log \ && ln -sf /dev/stderr ${APACHE_LOG_DIR}/error.log diff --git a/sysPass-php7.0/entrypoint.sh b/sysPass-php7.3_dev/common_fn.sh old mode 100755 new mode 100644 similarity index 53% rename from sysPass-php7.0/entrypoint.sh rename to sysPass-php7.3_dev/common_fn.sh index 762b71b..ab6e728 --- a/sysPass-php7.0/entrypoint.sh +++ b/sysPass-php7.3_dev/common_fn.sh @@ -1,20 +1,55 @@ -#!/bin/bash +: ${XDEBUG_REMOTE_HOST:="172.17.0.1"} +: ${XDEBUG_IDE_KEY:="ide"} +: ${SYSPASS_DEV:=0} +: ${PHP_XDEBUG_FILE:="/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"} +: ${SYSPASS_LOCALES:="es_ES en_US en_GB de_DE ca_ES fr_FR ru_RU pl_PL nl_NL pt_BR da_DK it_IT fo_FO ja_JP"} +: ${COMPOSER_EXTENSIONS:=} +: ${DEBUG:=0} + +if [ ${DEBUG} -eq 1 ]; then + set -x +fi + +COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +GOSU="gosu ${SYSPASS_UID}" COLOR_NC='\033[0m' COLOR_YELLOW='\033[0;33m' COLOR_RED='\033[0;31m' COLOR_GREEN='\033[0;32m' -XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST:-"172.17.0.1"} -XDEBUG_IDE_KEY=${XDEBUG_IDE_KEY:-"ide"} +if [ ${SYSPASS_DEV} -eq 1 ]; then + COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" +fi -COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +setup_apache () { + if [ ${SYSPASS_DEV} -eq 0 ]; then + return 0 + fi -GOSU="gosu ${SYSPASS_UID}" + echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" -if [ -e /usr/local/sbin/init-functions ]; then - . /usr/local/sbin/init-functions -fi + sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/; + s/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' \ + ${PHP_XDEBUG_FILE} +} + +run_apache () { + : ${PHP_INI_DIR:=} + + if [ -z "${PHP_INI_DIR}" ]; then + echo -e "${COLOR_YELLOW}run_apache: Starting Apache${COLOR_NC}" + + # Apache gets grumpy about PID files pre-existing + rm -f ${APACHE_PID_FILE} + + exec /usr/sbin/apache2ctl -DFOREGROUND + else + echo -e "${COLOR_YELLOW}run_apache: Starting Apache (PHP)${COLOR_NC}" + + apache2-foreground + fi +} setup_app () { if [ -e "${SYSPASS_DIR}/index.php" ]; then @@ -45,19 +80,10 @@ setup_locales() { echo -e "${COLOR_YELLOW}setup_locales: Setting up locales${COLOR_NC}" echo -e "\n### sysPass locales" >> $LOCALE_GEN - echo "es_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_US.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_GB.UTF-8 UTF-8" >> $LOCALE_GEN - echo "de_DE.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ca_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fr_FR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ru_RU.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pl_PL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "nl_NL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pt_BR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "da.UTF-8 UTF-8" >> $LOCALE_GEN - echo "it_IT.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fo.UTF-8 UTF-8" >> $LOCALE_GEN + + for LOCALE in ${SYSPASS_LOCALES}; do + echo "${LOCALE}.UTF-8 UTF-8" >> $LOCALE_GEN + done echo 'LANG="en_US.UTF-8"' > /etc/default/locale @@ -94,37 +120,3 @@ setup_composer_extensions () { run_composer require ${COMPOSER_EXTENSIONS} --update-no-dev fi } - -echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" -id ${SYSPASS_UID} > /dev/null 2>&1 || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user -export HOME=${SYSPASS_DIR} - -setup_app - -case "$1" in - "apache") - setup_composer_extensions - setup_locales - setup_apache - - SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) - - echo -e "${COLOR_GREEN}######" - echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation" - echo -e "######${COLOR_NC}" - echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" - - run_apache - ;; - "update") - run_composer update - ;; - "composer") - shift - run_composer "$@" - ;; - *) - echo -e "${COLOR_YELLOW}entrypoint: Starting $@${COLOR_NC}" - exec ${GOSU} "$@" - ;; -esac diff --git a/sysPass-php7.1/docker-compose.yml b/sysPass-php7.3_dev/docker-compose.yml similarity index 91% rename from sysPass-php7.1/docker-compose.yml rename to sysPass-php7.3_dev/docker-compose.yml index 936b001..3b2720a 100644 --- a/sysPass-php7.1/docker-compose.yml +++ b/sysPass-php7.3_dev/docker-compose.yml @@ -2,7 +2,7 @@ version: '2' services: app: container_name: syspass-app - image: syspass/syspass:3.1.2-php7.1 + image: syspass/syspass:3.2.0-php7.3 restart: always ports: - "80" diff --git a/sysPass-php7.3_dev/entrypoint.sh b/sysPass-php7.3_dev/entrypoint.sh new file mode 100755 index 0000000..2dd6df3 --- /dev/null +++ b/sysPass-php7.3_dev/entrypoint.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +set -euo pipefail + +COMMON_FN="common_fn.sh" + +source ${COMMON_FN} + +echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" + +id ${SYSPASS_UID} > /dev/null 2>&1 \ + || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user + +export HOME=${SYSPASS_DIR} + +setup_app + +case "$1" in + "apache") + setup_composer_extensions + setup_locales + setup_apache + + SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) + + echo -e "${COLOR_GREEN}######" + echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation." + echo -e "######${COLOR_NC}" + echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" + + run_apache + ;; + "update") + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + + run_composer update + ;; + "composer") + shift + + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + + run_composer "$@" + ;; + *) + echo -e "${COLOR_YELLOW}entrypoint: Starting $@${COLOR_NC}" + exec ${GOSU} "$@" + ;; +esac diff --git a/sysPass-php7.0/syspass.conf b/sysPass-php7.3_dev/syspass.conf similarity index 100% rename from sysPass-php7.0/syspass.conf rename to sysPass-php7.3_dev/syspass.conf diff --git a/sysPass-php7.1/Dockerfile b/sysPass-php7.4/Dockerfile similarity index 65% rename from sysPass-php7.1/Dockerfile rename to sysPass-php7.4/Dockerfile index b8e5540..60fe5ba 100644 --- a/sysPass-php7.1/Dockerfile +++ b/sysPass-php7.4/Dockerfile @@ -3,11 +3,11 @@ # https://doc.syspass.org # -FROM composer:1.7 as bootstrap +FROM composer:1.10 as bootstrap -ENV SYSPASS_BRANCH="master" +ENV SYSPASS_BRANCH="3.2.0" -RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ +RUN git clone --depth 1 --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git \ && composer install \ --ignore-platform-reqs \ --no-interaction \ @@ -17,13 +17,14 @@ RUN git clone --branch ${SYSPASS_BRANCH} https://github.com/nuxsmin/sysPass.git --optimize-autoloader \ --working-dir /app/sysPass -FROM php:7.1-apache-stretch as app +FROM php:7.4-apache-buster as app -LABEL maintainer=nuxsmin@syspass.org version=3.1.2 php=7.1 +LABEL maintainer=nuxsmin@syspass.org version=3.2.0 php=7.4 RUN apt-get update \ - && DEBIAN_FRONTEND=noninteractive apt-get -y install \ + && apt-get install -y \ locales \ + locales-all \ git \ gosu \ libicu-dev \ @@ -34,12 +35,13 @@ RUN apt-get update \ libpng-dev \ unzip \ ssl-cert \ - && apt-get clean \ - && rm -r /var/lib/apt/lists/* \ - && pecl install xdebug-2.6.0 \ - && docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \ - && docker-php-ext-install -j$(nproc) ldap intl gettext pdo_mysql opcache gd \ - && docker-php-ext-enable ldap xdebug intl pdo_mysql + && apt-get clean \ + && rm -r /var/lib/apt/lists/* + +RUN pecl install xdebug-2.9.8 \ + && docker-php-ext-configure gd --with-freetype --with-jpeg \ + && docker-php-ext-install -j$(nproc) ldap intl gettext pdo_mysql opcache gd \ + && docker-php-ext-enable ldap xdebug intl pdo_mysql ENV APACHE_RUN_USER="www-data" \ SYSPASS_DIR="/var/www/html/sysPass" \ @@ -48,7 +50,7 @@ ENV APACHE_RUN_USER="www-data" \ WORKDIR /var/www/html -LABEL build=19030701 +LABEL build=20122001 # Custom sysPass Apache config with SSL by default COPY ["syspass.conf", "/etc/apache2/sites-available/"] @@ -57,7 +59,7 @@ COPY ["syspass.conf", "/etc/apache2/sites-available/"] COPY xdebug.ini /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini # Custom entrypoint -COPY entrypoint.sh init-functions /usr/local/sbin/ +COPY entrypoint.sh common_fn.sh /usr/local/sbin/ RUN chmod 755 /usr/local/sbin/entrypoint.sh \ && a2dissite 000-default default-ssl \ diff --git a/sysPass-php7.0_dev/entrypoint.sh b/sysPass-php7.4/common_fn.sh old mode 100755 new mode 100644 similarity index 53% rename from sysPass-php7.0_dev/entrypoint.sh rename to sysPass-php7.4/common_fn.sh index 762b71b..ab6e728 --- a/sysPass-php7.0_dev/entrypoint.sh +++ b/sysPass-php7.4/common_fn.sh @@ -1,20 +1,55 @@ -#!/bin/bash +: ${XDEBUG_REMOTE_HOST:="172.17.0.1"} +: ${XDEBUG_IDE_KEY:="ide"} +: ${SYSPASS_DEV:=0} +: ${PHP_XDEBUG_FILE:="/usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini"} +: ${SYSPASS_LOCALES:="es_ES en_US en_GB de_DE ca_ES fr_FR ru_RU pl_PL nl_NL pt_BR da_DK it_IT fo_FO ja_JP"} +: ${COMPOSER_EXTENSIONS:=} +: ${DEBUG:=0} + +if [ ${DEBUG} -eq 1 ]; then + set -x +fi + +COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +GOSU="gosu ${SYSPASS_UID}" COLOR_NC='\033[0m' COLOR_YELLOW='\033[0;33m' COLOR_RED='\033[0;31m' COLOR_GREEN='\033[0;32m' -XDEBUG_REMOTE_HOST=${XDEBUG_REMOTE_HOST:-"172.17.0.1"} -XDEBUG_IDE_KEY=${XDEBUG_IDE_KEY:-"ide"} +if [ ${SYSPASS_DEV} -eq 1 ]; then + COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --optimize-autoloader --dev" +fi -COMPOSER_OPTIONS="--working-dir ${SYSPASS_DIR} --classmap-authoritative" +setup_apache () { + if [ ${SYSPASS_DEV} -eq 0 ]; then + return 0 + fi -GOSU="gosu ${SYSPASS_UID}" + echo -e "${COLOR_YELLOW}setup_apache: Setting up xdebug variables${COLOR_NC}" -if [ -e /usr/local/sbin/init-functions ]; then - . /usr/local/sbin/init-functions -fi + sed -i 's/__XDEBUG_REMOTE_HOST__/'"$XDEBUG_REMOTE_HOST"'/; + s/__XDEBUG_IDE_KEY__/'"$XDEBUG_IDE_KEY"'/' \ + ${PHP_XDEBUG_FILE} +} + +run_apache () { + : ${PHP_INI_DIR:=} + + if [ -z "${PHP_INI_DIR}" ]; then + echo -e "${COLOR_YELLOW}run_apache: Starting Apache${COLOR_NC}" + + # Apache gets grumpy about PID files pre-existing + rm -f ${APACHE_PID_FILE} + + exec /usr/sbin/apache2ctl -DFOREGROUND + else + echo -e "${COLOR_YELLOW}run_apache: Starting Apache (PHP)${COLOR_NC}" + + apache2-foreground + fi +} setup_app () { if [ -e "${SYSPASS_DIR}/index.php" ]; then @@ -45,19 +80,10 @@ setup_locales() { echo -e "${COLOR_YELLOW}setup_locales: Setting up locales${COLOR_NC}" echo -e "\n### sysPass locales" >> $LOCALE_GEN - echo "es_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_US.UTF-8 UTF-8" >> $LOCALE_GEN - echo "en_GB.UTF-8 UTF-8" >> $LOCALE_GEN - echo "de_DE.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ca_ES.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fr_FR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "ru_RU.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pl_PL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "nl_NL.UTF-8 UTF-8" >> $LOCALE_GEN - echo "pt_BR.UTF-8 UTF-8" >> $LOCALE_GEN - echo "da.UTF-8 UTF-8" >> $LOCALE_GEN - echo "it_IT.UTF-8 UTF-8" >> $LOCALE_GEN - echo "fo.UTF-8 UTF-8" >> $LOCALE_GEN + + for LOCALE in ${SYSPASS_LOCALES}; do + echo "${LOCALE}.UTF-8 UTF-8" >> $LOCALE_GEN + done echo 'LANG="en_US.UTF-8"' > /etc/default/locale @@ -94,37 +120,3 @@ setup_composer_extensions () { run_composer require ${COMPOSER_EXTENSIONS} --update-no-dev fi } - -echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" -id ${SYSPASS_UID} > /dev/null 2>&1 || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user -export HOME=${SYSPASS_DIR} - -setup_app - -case "$1" in - "apache") - setup_composer_extensions - setup_locales - setup_apache - - SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) - - echo -e "${COLOR_GREEN}######" - echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation" - echo -e "######${COLOR_NC}" - echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" - - run_apache - ;; - "update") - run_composer update - ;; - "composer") - shift - run_composer "$@" - ;; - *) - echo -e "${COLOR_YELLOW}entrypoint: Starting $@${COLOR_NC}" - exec ${GOSU} "$@" - ;; -esac diff --git a/sysPass-php7.2/docker-compose.yml b/sysPass-php7.4/docker-compose.yml similarity index 91% rename from sysPass-php7.2/docker-compose.yml rename to sysPass-php7.4/docker-compose.yml index ad7e58c..985ca76 100644 --- a/sysPass-php7.2/docker-compose.yml +++ b/sysPass-php7.4/docker-compose.yml @@ -2,7 +2,7 @@ version: '2' services: app: container_name: syspass-app - image: syspass/syspass:3.1.2-php7.2 + image: syspass/syspass:3.2.0-php7.4 restart: always ports: - "80" diff --git a/sysPass-php7.4/entrypoint.sh b/sysPass-php7.4/entrypoint.sh new file mode 100755 index 0000000..2dd6df3 --- /dev/null +++ b/sysPass-php7.4/entrypoint.sh @@ -0,0 +1,55 @@ +#!/usr/bin/env bash + +set -euo pipefail + +COMMON_FN="common_fn.sh" + +source ${COMMON_FN} + +echo -e "${COLOR_YELLOW}entrypoint: Starting with UID : ${SYSPASS_UID}${COLOR_NC}" + +id ${SYSPASS_UID} > /dev/null 2>&1 \ + || useradd --shell /bin/bash -u ${SYSPASS_UID} -o -c "" -m user + +export HOME=${SYSPASS_DIR} + +setup_app + +case "$1" in + "apache") + setup_composer_extensions + setup_locales + setup_apache + + SELF_IP_ADDRESS=$(grep $HOSTNAME /etc/hosts | cut -f1) + + echo -e "${COLOR_GREEN}######" + echo -e "sysPass environment installed and configured. Please point your browser to https://${SELF_IP_ADDRESS} to start the installation." + echo -e "######${COLOR_NC}" + echo -e "${COLOR_YELLOW}entrypoint: Starting Apache${COLOR_NC}" + + run_apache + ;; + "update") + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + + run_composer update + ;; + "composer") + shift + + echo -e "${COLOR_YELLOW}######" + echo -e "Please, only run this command for debuging purposes." + echo -e "In order to update the dependencies, please, download and updated image" + echo -e "######${COLOR_NC}" + + run_composer "$@" + ;; + *) + echo -e "${COLOR_YELLOW}entrypoint: Starting $@${COLOR_NC}" + exec ${GOSU} "$@" + ;; +esac diff --git a/sysPass-php7.0_dev/syspass.conf b/sysPass-php7.4/syspass.conf similarity index 100% rename from sysPass-php7.0_dev/syspass.conf rename to sysPass-php7.4/syspass.conf diff --git a/sysPass-php7.2/xdebug.ini b/sysPass-php7.4/xdebug.ini similarity index 96% rename from sysPass-php7.2/xdebug.ini rename to sysPass-php7.4/xdebug.ini index 53bf972..f057286 100644 --- a/sysPass-php7.2/xdebug.ini +++ b/sysPass-php7.4/xdebug.ini @@ -1,5 +1,4 @@ -; zend_extension=xdebug.so -zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20170718/xdebug.so +zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20190902/xdebug.so [debug] ; Remote settings