FROM ubuntu:18.04 as builder RUN apt -y update || true; apt -y install gcc COPY ./pause /pause RUN cd /pause && gcc ./main.c -o pauser FROM ubuntu:18.04 RUN groupadd postgres && useradd -d /home/postgres -ms /bin/bash -g postgres -G sudo postgres RUN export DEBIAN_FRONTEND=noninteractive; \ apt -y update || true; \ apt -y install tzdata; \ ln -fs /usr/share/zoneinfo/America/Denver /etc/localtime; \ dpkg-reconfigure --frontend noninteractive tzdata; \ apt -y install \ curl \ rsync \ cron \ postgresql postgresql-contrib \ && curl -L \ https://github.com/miniflux/miniflux/releases/download/2.0.21/miniflux_2.0.21_amd64.deb \ > /miniflux.deb \ && dpkg -i /miniflux.deb \ && mkdir -p /mnt/save USER postgres RUN service postgresql start && sleep 10 \ && psql --command "CREATE USER mini WITH SUPERUSER PASSWORD 'pwd';" \ && createdb -O mini pwd \ && psql --command "CREATE DATABASE miniflux;" \ && psql --command "GRANT ALL PRIVILEGES ON DATABASE miniflux TO mini;" \ && service postgresql stop && sleep 10 ENV DATABASE_URL=postgres://mini:pwd@localhost/miniflux?sslmode=disable ENV LISTEN_ADDR=:8032 ENV RUN_MIGRATIONS=1 ENV CREATE_ADMIN=1 ENV ADMIN_USERNAME=username ENV ADMIN_PASSWORD=password ENV RUN_MIGRATIONS=0 ENV CREATE_ADMIN=0 COPY --from=builder /pause/pauser /pauser COPY backup.sh / COPY restore.sh / USER root ### CRON BACKUPS 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 \ && touch /var/log/cronj.log ENTRYPOINT \ service postgresql start \ && until psql $DATABASE_URL < /dev/null; do sleep 5; done \ && bash /restore.sh \ && miniflux -migrate \ && miniflux -create-admin \ && miniflux \ & exec /pauser