Skip to content

Commit 74e7b79

Browse files
author
Cyril
committed
First try for a dockerized install
1 parent 6b97162 commit 74e7b79

File tree

4 files changed

+117
-0
lines changed

4 files changed

+117
-0
lines changed

docker/.env

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
DATABASE_URL=mysql://davis:davis@127.0.0.1:3306/davis
2+
3+
ADMIN_LOGIN=admin
4+
ADMIN_PASSWORD=test
5+
6+
AUTH_REALM=SabreDAV
7+
8+
AUTH_METHOD=Basic
9+
10+
CALDAV_ENABLED=true
11+
CARDDAV_ENABLED=true
12+
WEBDAV_ENABLED=false
13+
14+
TMP_DIR='/tmp'
15+
PUBLIC_DIR='/public'
16+
17+
HOSTNAME=dav.mydomain.tld
18+
19+
INVITE_FROM_ADDRESS=no-reply@example.org
20+
EMAIL=no-reply@mydomain.tld
21+
MAIL_HOST=smtp.myprovider.com
22+
MAIL_USERNAME=userdav
23+
MAIL_PASSWORD=test

docker/Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM php:7.2-fpm
2+
3+
# Mail : configuration for ssmtp
4+
ARG email
5+
ARG mail_host
6+
ARG hostname
7+
ARG mail_username
8+
ARG mail_password
9+
10+
# Mail : compile ssmtp
11+
RUN curl -O http://cdn-fastly.deb.debian.org/debian/pool/main/s/ssmtp/ssmtp_2.64.orig.tar.bz2 && \
12+
bunzip2 ssmtp_2.64.orig.tar.bz2 && \
13+
tar -xvf ssmtp_2.64.orig.tar && \
14+
cd ssmtp-2.64 && ./configure && make && \
15+
echo "echo 'Skipping config generation'" > generate_config && make install && \
16+
cd .. && rm -rf ssmtp-2.64 && rm ssmtp_2.64.orig.tar
17+
18+
COPY configurations/php-mail.ini /usr/local/etc/php/conf.d/mail.ini
19+
RUN echo "root=${email}\nmailhub=${mail_host}\nrewriteDomain= \
20+
\nhostname=${hostname}\nFromLineOverride=YES \
21+
\nAuthUser=${mail_username}\nAuthPass=${mail_password}\n" > /usr/local/etc/ssmtp/ssmtp.conf
22+
23+
# Run update, and gets basic packages
24+
RUN apt-get update && apt-get install -y --no-install-recommends \
25+
curl \
26+
unzip \
27+
&& apt-get clean && rm -rf /var/lib/apt/lists/*
28+
29+
# Configure PHP extensions
30+
RUN docker-php-ext-configure pdo_mysql --with-pdo-mysql=mysqlnd \
31+
&& docker-php-ext-install pdo_mysql \
32+
&& docker-php-source delete
33+
34+
# Davis installation
35+
36+
RUN cd /tmp/ && curl --silent -LO https://github.com/tchapi/davis/archive/v1.0.0.zip \
37+
&& unzip /tmp/1.0.0.zip -d /var/www/ \
38+
&& rm -f /tmp/1.0.0.zip
39+
RUN mv /var/www/1.0.0 /var/www/davis
40+
41+
WORKDIR /var/www/davis
42+
43+
# Install dependencies, and migrate the database if needed
44+
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
45+
RUN composer install --no-ansi --no-dev --no-interaction --no-progress --optimize-autoloader
46+
RUN bin/console migrate --no-interaction
47+
48+
RUN chown -Rf www-data:www-data .
49+
RUN chmod -Rf g+w .

docker/configurations/php-mail.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[mail function]
2+
sendmail_path = "/usr/local/sbin/ssmtp -t"

docker/docker-compose.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
version: "3.7"
2+
3+
services:
4+
5+
nginx:
6+
image: nginx:alpine
7+
container_name: nginx
8+
env_file: .env
9+
command: "/bin/sh -c 'while :; do sleep 6h & wait $${!}; nginx -s reload; done & nginx -g \"daemon off;\"'"
10+
depends_on:
11+
- davis
12+
volumes:
13+
- davis_www:/var/www/davis
14+
ports:
15+
- 80:80
16+
- 443:443
17+
18+
mysql:
19+
image: mariadb:latest
20+
container_name: mysql
21+
env_file: .env
22+
23+
davis:
24+
build:
25+
context: ./
26+
dockerfile: ./Dockerfile
27+
args:
28+
email: ${INVITE_FROM_ADDRESS}
29+
mail_host: ${MAIL_HOST}
30+
calendar_domain: ${HOSTNAME}
31+
mail_username: ${MAIL_USERNAME}
32+
mail_password: ${MAIL_PASSWORD}
33+
image: davis:master
34+
container_name: davis
35+
env_file: .env
36+
depends_on:
37+
- mysql
38+
volumes:
39+
- davis_www:/var/www/davis
40+
41+
volumes:
42+
davis_www:
43+
name: davis_www

0 commit comments

Comments
 (0)