diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d1c9d7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*~ +/.idea/ +/docker-compose.override.yml diff --git a/Dockerfile b/Dockerfile index 16f48a5..707e701 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,32 +3,36 @@ # https://github.com/eventum/eventum # -FROM php:5.6-fpm +FROM phpearth/php:7.1-nginx AS base -ARG EVENTUM_VERSION=3.3.3 -ARG EVENTUM_MD5=7fde18feb868ad965aa186418eccd1c1 +FROM base AS source +RUN apk add --no-cache curl -WORKDIR /usr/src/eventum +# download and unpack code +WORKDIR /source +ARG VERSION=3.7.1 +RUN curl -fLSs https://github.com/eventum/eventum/releases/download/v$VERSION/eventum-$VERSION.tar.xz -o eventum.tar.xz -# step1: install eventum code -RUN set -xe \ - && curl -fLSs https://github.com/eventum/eventum/releases/download/v$EVENTUM_VERSION/eventum-$EVENTUM_VERSION.tar.gz -o eventum.tgz \ - && echo "$EVENTUM_MD5 *eventum.tgz" | md5sum -c - \ - && tar --strip-components=1 -xzf eventum.tgz \ - && rm -f eventum.tgz \ +ARG CHECKSUM=060b2fa8b09cebaf442c2088137998fdfce1082487d83115cafa49bf12834689 +RUN sha256sum eventum.tar.xz +RUN echo "$CHECKSUM *eventum.tar.xz" | sha256sum -c - + +WORKDIR /app +RUN tar --strip-components=1 -xf /source/eventum.tar.xz + +COPY php.ini /php.ini +RUN chmod 644 /php.ini + +# build runtime image +FROM base +RUN apk add --no-cache php7.1-gd php7.1-intl php7.1-pdo_mysql +# update to use app root; required to change config as expose only subdir +RUN sed -i -e '/root/ s;/var/www/html;/app/htdocs;' /etc/nginx/conf.d/default.conf + +WORKDIR /app +COPY --from=source /php.ini /etc/php/7.1/php.ini +COPY --from=source /app ./ +RUN set -x \ && chmod -R og-rwX config var \ && chown -R www-data: config var \ && du -sh - -# step2: install dependencies -RUN set -xe \ - && ln -s /usr/local/bin/php /usr/bin \ - && apt-get update \ - && apt-get install -y --no-install-recommends libpng-dev libmcrypt-dev \ - && docker-php-ext-install pdo pdo_mysql gd mcrypt \ - && apt-get remove -y zlib1g-dev libpng12-dev zlib1g-dev libmcrypt-dev \ - && apt-get clean \ - && rm -rfv /var/lib/apt/lists/* /tmp/* /var/tmp/* \ - && php -m - -USER www-data diff --git a/docker-compose.yml b/docker-compose.yml index 6c724c2..bfcbdd6 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,35 +1,32 @@ version: '2.1' -volumes: - config: - mysql: - code: - name: eventum-3.3.3 - services: eventum: - image: eventum/eventum:3.3.3 + build: . volumes: - - code:/usr/src/eventum - - config:/usr/src/eventum/config - links: - - mysql + - ./php.ini:/etc/php/7.1/php.ini + ports: + - "8088:80" + logging: + driver: json-file + options: + max-size: "10m" + max-file: "10" mysql: - image: mysql:5.6 + image: percona:5.7 volumes: - mysql:/var/lib/mysql environment: - MYSQL_ALLOW_EMPTY_PASSWORD=1 - MYSQL_DATABASE=eventum + logging: + driver: json-file + options: + max-size: "10m" + max-file: "10" - nginx: - build: nginx - ports: - - "8088:80" - links: - - eventum:fpm - volumes: - - code:/usr/src/eventum:ro +volumes: + mysql: # vim:ts=2:sw=2:et diff --git a/nginx/Dockerfile b/nginx/Dockerfile deleted file mode 100644 index 8f0fe0b..0000000 --- a/nginx/Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -# -# Dockerfile for Eventum nginx -# https://github.com/eventum/eventum -# - -FROM nginx:alpine - -ADD nginx.conf /etc/nginx/conf.d/default.conf diff --git a/nginx/nginx.conf b/nginx/nginx.conf deleted file mode 100644 index 5caff5d..0000000 --- a/nginx/nginx.conf +++ /dev/null @@ -1,17 +0,0 @@ -server { - server_name eventum; - listen 80; - - root /usr/src/eventum/htdocs; - index index.php; - - location / { - try_files $uri $uri/ /index.php$is_args$args; - } - - location ~ \.php$ { - include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_pass fpm:9000; - } -} diff --git a/php.ini b/php.ini new file mode 100644 index 0000000..d4f145a --- /dev/null +++ b/php.ini @@ -0,0 +1,23 @@ +; disable production reporting +; Production Value: E_ALL & ~E_DEPRECATED & ~E_STRICT +; http://php.net/error-reporting +error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT + +; Default Value: On +; Development Value: On +; Production Value: Off +; http://php.net/display-errors +display_errors = Off + +; Default Value: Off +; Development Value: On +; Production Value: On +; http://php.net/log-errors +log_errors = On + +; Decides whether PHP may expose the fact that it is installed on the server +; (e.g. by adding its signature to the Web server header). It is no security +; threat in any way, but it makes it possible to determine whether you use PHP +; on your server or not. +; http://php.net/expose-php +expose_php = Off