First try for a dockerized install

This commit is contained in:
Cyril 2019-11-04 17:22:15 +01:00
parent 6b97162066
commit 74e7b79eb4
4 changed files with 117 additions and 0 deletions

23
docker/.env Normal file
View File

@ -0,0 +1,23 @@
DATABASE_URL=mysql://davis:davis@127.0.0.1:3306/davis
ADMIN_LOGIN=admin
ADMIN_PASSWORD=test
AUTH_REALM=SabreDAV
AUTH_METHOD=Basic
CALDAV_ENABLED=true
CARDDAV_ENABLED=true
WEBDAV_ENABLED=false
TMP_DIR='/tmp'
PUBLIC_DIR='/public'
HOSTNAME=dav.mydomain.tld
INVITE_FROM_ADDRESS=no-reply@example.org
EMAIL=no-reply@mydomain.tld
MAIL_HOST=smtp.myprovider.com
MAIL_USERNAME=userdav
MAIL_PASSWORD=test

49
docker/Dockerfile Normal file
View File

@ -0,0 +1,49 @@
FROM php:7.2-fpm
# Mail : configuration for ssmtp
ARG email
ARG mail_host
ARG hostname
ARG mail_username
ARG mail_password
# Mail : compile ssmtp
RUN curl -O http://cdn-fastly.deb.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.64.orig.tar.bz2 && \
bunzip2 ssmtp_2.64.orig.tar.bz2 && \
tar -xvf ssmtp_2.64.orig.tar && \
cd ssmtp-2.64 && ./configure && make && \
echo "echo 'Skipping config generation'" > generate_config && make install && \
cd .. && rm -rf ssmtp-2.64 && rm ssmtp_2.64.orig.tar
COPY configurations/php-mail.ini /usr/local/etc/php/conf.d/mail.ini
RUN echo "root=${email}\nmailhub=${mail_host}\nrewriteDomain= \
\nhostname=${hostname}\nFromLineOverride=YES \
\nAuthUser=${mail_username}\nAuthPass=${mail_password}\n" > /usr/local/etc/ssmtp/ssmtp.conf
# Run update, and gets basic packages
RUN apt-get update && apt-get install -y --no-install-recommends \
curl \
unzip \
&& apt-get clean && rm -rf /var/lib/apt/lists/*
# Configure PHP extensions
RUN docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
&& docker-php-ext-install pdo_mysql \
&& docker-php-source delete
# Davis installation
RUN cd /tmp/ && curl --silent -LO https://github.com/tchapi/davis/archive/v1.0.0.zip \
&& unzip /tmp/1.0.0.zip -d /var/www/ \
&& rm -f /tmp/1.0.0.zip
RUN mv /var/www/1.0.0 /var/www/davis
WORKDIR /var/www/davis
# Install dependencies, and migrate the database if needed
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader
RUN bin/console migrate --no-interaction
RUN chown -Rf www-data:www-data .
RUN chmod -Rf g+w .

View File

@ -0,0 +1,2 @@
[mail function]
sendmail_path = "/usr/local/sbin/ssmtp -t"

43
docker/docker-compose.yml Normal file
View File

@ -0,0 +1,43 @@
version: "3.7"
services:
nginx:
image: nginx:alpine
container_name: nginx
env_file: .env
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
depends_on:
- davis
volumes:
- davis_www:/var/www/davis
ports:
- 80:80
- 443:443
mysql:
image: mariadb:latest
container_name: mysql
env_file: .env
davis:
build:
context: ./
dockerfile: ./Dockerfile
args:
email: ${INVITE_FROM_ADDRESS}
mail_host: ${MAIL_HOST}
calendar_domain: ${HOSTNAME}
mail_username: ${MAIL_USERNAME}
mail_password: ${MAIL_PASSWORD}
image: davis:master
container_name: davis
env_file: .env
depends_on:
- mysql
volumes:
- davis_www:/var/www/davis
volumes:
davis_www:
name: davis_www