diff --git a/Dockerfile b/Dockerfile index 74763eb..fffc4aa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,19 @@ FROM trafex/alpine-nginx-php7:latest AS webserver LABEL maintainer="matteo@matteogheza.it" -LABEL version="1.2" +LABEL version="1.0" LABEL description="Docker project for open source firefighter management software" +COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf COPY ./server /var/www/html - -# Install composer from the official image COPY --from=composer /usr/bin/composer /usr/bin/composer WORKDIR /var/www/html USER root -RUN apk add --no-cache bash sed php-pdo php-pdo_mysql php-pdo_sqlite php-pdo_pgsql -RUN composer install --optimize-autoloader --no-interaction --no-progress +RUN apk add --no-cache bash sed php-pdo php-pdo_mysql php-pdo_sqlite php-pdo_pgsql git +RUN composer install --no-dev --optimize-autoloader --no-interaction --no-progress + +#RUN echo "@reboot cd /var/www/html/install && php install.php config" > /etc/crontabs/root USER nobody EXPOSE 8080 \ No newline at end of file diff --git a/docker-compose.yaml b/docker-compose.yaml index d5e9356..7655f11 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,29 +1,30 @@ version: '3.3' services: - db: - image: mariadb:latest - volumes: - - db_data:/var/lib/mysql - restart: always - environment: - MYSQL_ROOT_PASSWORD: root - MYSQL_DATABASE: allerta-db - MYSQL_USER: allerta - MYSQL_PASSWORD: password - - allerta: - depends_on: - - db - image: allertavvf/allertavvf - build: ./ - ports: - - "8081:8080" - restart: always - environment: - ALLERTA_DB_HOST: db:3306 - ALLERTA_DB_USER: allerta - ALLERTA_DB_PASSWORD: password - ALLERTA_DB_NAME: allerta-db + db: + image: mariadb:latest + volumes: + - db_data:/var/lib/mysql + restart: always + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_USER: allerta + MYSQL_PASSWORD: password + MYSQL_DATABASE: allerta-db + allerta: + depends_on: + - db + links: + - db:db + image: allertavvf/allertavvf + build: ./ + ports: + - "8081:8080" + restart: always + environment: + DB_HOST: db + DB_USERNAME: root + DB_PASSWORD: root + DB_NAME: allerta-db volumes: - db_data: {} \ No newline at end of file + db_data: {} \ No newline at end of file diff --git a/server/install/installHelper.php b/server/install/installHelper.php index 52d0bdd..b6dad6d 100644 --- a/server/install/installHelper.php +++ b/server/install/installHelper.php @@ -393,7 +393,7 @@ INSERT INTO `".$prefix."_options` (`id`, `name`, `value`, `enabled`, `created_ti } function validate_arg($options, $name, $default){ - return array_key_exists($name, $options) ? $options[$name] : (isset($_ENV[$name]) ? $_ENV[$name] : (isset($_ENV[strtoupper($name)]) ? $_ENV[strtoupper($name)] : $default)); + return array_key_exists($name, $options) ? $options[$name] : (getenv($name)!==false ? getenv($name) : (getenv(strtoupper($name))!==false ? getenv(strtoupper($name)) : $default)); } function change_dir($directory){ diff --git a/supervisord.conf b/supervisord.conf new file mode 100644 index 0000000..e435433 --- /dev/null +++ b/supervisord.conf @@ -0,0 +1,42 @@ +[supervisord] +nodaemon=true +logfile=/dev/null +logfile_maxbytes=0 +pidfile=/run/supervisord.pid + +[program:php-fpm] +command=php-fpm7 -F +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +autorestart=false +startretries=0 + +[program:nginx] +command=nginx -g 'daemon off;' +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +autorestart=false +startretries=0 + +[program:crond] +command=crond -f +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +autorestart=false +startretries=0 + +[program:configurator] +command=sh -c "sleep 3;php install.php config" +stdout_logfile=/dev/stdout +stdout_logfile_maxbytes=0 +stderr_logfile=/dev/stderr +stderr_logfile_maxbytes=0 +autorestart=false +startretries=0 +directory=/var/www/html/install \ No newline at end of file