37 lines
1.7 KiB
Docker
37 lines
1.7 KiB
Docker
FROM kanboard/kanboard:v1.2.14
|
|
|
|
RUN apk update \
|
|
&& apk add --no-cache \
|
|
postgresql \
|
|
dcron \
|
|
curl \
|
|
&& mkdir -p /var/lib/postgresql/12/main \
|
|
&& chown -R postgres:postgres /var/lib/postgresql \
|
|
&& chmod -R 750 /var/lib/postgresql \
|
|
&& su postgres -c "initdb -D /var/lib/postgresql/12/main/" \
|
|
&& mkdir -p /var/run/postgresql/ \
|
|
&& chown -R postgres:postgres /var/run/postgresql \
|
|
&& chmod -R 750 /var/run/postgresql
|
|
RUN su postgres -c 'postgres --config-file=/var/lib/postgresql/12/main/postgresql.conf -D /var/lib/postgresql/12/main' \
|
|
& until su postgres -c 'psql --command "CREATE USER admin WITH SUPERUSER PASSWORD '"'"'admin'"'"';"'; do sleep 1; done \
|
|
&& su postgres -c 'psql --command "CREATE DATABASE db;"' \
|
|
&& su postgres -c 'psql --command "GRANT ALL PRIVILEGES ON DATABASE db TO admin;"' \
|
|
&& kill %1 \
|
|
&& wait
|
|
|
|
RUN mkdir -p \
|
|
/etc/nginx/ssl \
|
|
/var/www/app/data \
|
|
/var/www/app/plugins \
|
|
&& chown -R nginx:nginx /var/www/app
|
|
|
|
RUN echo '0 */4 * * * bash -c "true; bash /backup.sh &>> /tmp/backup.log"' >> /etc/crontabs/root
|
|
|
|
ENV DATABASE_URL=postgres://admin:admin@127.0.0.1/db
|
|
COPY backup.sh /backup.sh
|
|
COPY restore.sh /restore.sh
|
|
|
|
CMD []
|
|
ENTRYPOINT ["bash", "-c", "true; clean() { bash /backup.sh; echo cleaned; exit 0; }; set -e; crond; (set -m; su postgres -c 'postgres --config-file=/var/lib/postgresql/12/main/postgresql.conf -D /var/lib/postgresql/12/main' & wait) &> /var/log/postgres.log & disown; until psql $DATABASE_URL < /dev/null; do sleep 1; done; bash /restore.sh; trap clean EXIT ERR INT; echo rm and start; rm -rf /etc/services.d/cron; bash /usr/local/bin/entrypoint.sh"]
|
|
|