76 lines
2.7 KiB
Docker
Executable File
76 lines
2.7 KiB
Docker
Executable File
FROM ubuntu:18.04
|
|
|
|
### APT
|
|
RUN apt -y update \
|
|
&& DEBIAN_FRONTEND=noninteractive apt -y install tzdata \
|
|
&& apt -y install locales language-pack-en-base \
|
|
&& echo '127.0.0.1 firefly-iii-domain.com firefly-iii localhost' >> /etc/hosts \
|
|
&& apt -y install \
|
|
postgresql postgresql-contrib \
|
|
nginx \
|
|
php-fpm php7.3-pgsql php-curl php-gd php-bcmath php-zip php-intl php-mbstring php-xml php-ldap \
|
|
curl \
|
|
gcc \
|
|
cron \
|
|
rsync \
|
|
sudo \
|
|
&& rm /etc/nginx/sites-enabled/default \
|
|
&& touch /etc/nginx/sites-available/firefly-iii.conf \
|
|
&& ln -s /etc/nginx/sites-available/firefly-iii.conf /etc/nginx/sites-enabled/firefly-iii.conf \
|
|
&& openssl dhparam 2048 > /etc/nginx/dhparam.pem
|
|
|
|
USER postgres
|
|
RUN service postgresql start && sleep 5 \
|
|
&& psql --command "CREATE DATABASE fireflyiii WITH ENCODING 'UTF8' TEMPLATE='template0';" \
|
|
&& psql --command "CREATE USER ffly WITH SUPERUSER PASSWORD 'pwd';" \
|
|
&& psql --command "GRANT ALL PRIVILEGES ON DATABASE fireflyiii TO ffly;" \
|
|
&& service postgresql stop && sleep 5
|
|
|
|
#&& sed 's/^password .*/password = pwd/' /etc/mysql/debian.cnf > /tmp/cnf \
|
|
#&& mv /tmp/cnf /etc/mysql/debian.cnf \
|
|
#&& echo 'create database fireflyiii character set utf8 collate utf8_bin; ' \
|
|
# 'grant all privileges on fireflyiii.* to fireflyiii@localhost identified by '"'"'pwd'"'"'; ' \
|
|
# | mysql --user=root --password=pwd mysql && echo made fireflyiii
|
|
USER root
|
|
|
|
### PHP
|
|
RUN service postgresql start && sleep 10 \
|
|
&& curl -sS https://getcomposer.org/installer \
|
|
| php -- --install-dir=/usr/local/bin --filename=composer \
|
|
&& cd /opt \
|
|
&& composer create-project grumpydictator/firefly-iii --no-dev --prefer-dist firefly-iii 5.0.1
|
|
COPY ./env /opt/firefly-iii/.env
|
|
RUN service postgresql start && sleep 10 \
|
|
&& cd /opt/firefly-iii \
|
|
&& php artisan migrate:refresh --seed \
|
|
&& php artisan passport:install \
|
|
&& chown -R www-data:www-data /opt/firefly-iii \
|
|
&& mkdir -p /run/php
|
|
|
|
### WAIT
|
|
COPY ./pause /xfer/
|
|
RUN cd /xfer && gcc main.c -o /xfer/pauser
|
|
|
|
### CONFIG
|
|
COPY ./env /opt/firefly-iii/.env
|
|
COPY ./firefly-iii.conf /etc/nginx/sites-enabled/
|
|
|
|
RUN apt -y autoremove \
|
|
&& apt -y purge --auto-remove gcc curl \
|
|
&& rm -rf /var/lib/apt \
|
|
&& apt clean
|
|
|
|
### CRON
|
|
RUN true \
|
|
&& echo '0 4,8,12,16,20 * * * bash /backup.sh >> /var/log/cronj.log 2>&1' > /etc/cron.d/backups \
|
|
&& echo '' >> /etc/cron.d/backups \
|
|
&& chmod 0644 /etc/cron.d/backups \
|
|
&& crontab /etc/cron.d/backups \
|
|
&& touch /var/log/cronj.log
|
|
|
|
### COPY
|
|
COPY ./backup.sh ./restore.sh ./entrypoint.sh /
|
|
|
|
### on enter/exit, rsync to/from /var/lib/mysql and /mnt
|
|
ENTRYPOINT bash /entrypoint.sh
|