modified: src/Dockerfile

modified:   src/entrypoint.sh
This commit is contained in:
Rubén Castro Gutiérrez 2021-03-23 12:52:00 +00:00
parent 5c33ccf0b1
commit 2ae078bda5
2 changed files with 40 additions and 10 deletions

View File

@ -1,11 +1,14 @@
FROM restic/restic:0.9.6
RUN apk update && apk add python3 dcron mariadb-client postgresql-client
RUN apk update && apk add ca-certificates python3 dcron mariadb-client postgresql-client && rm -rf /var/cache/apk/*
ADD . /restic-compose-backup
WORKDIR /restic-compose-backup
RUN pip3 install -U pip setuptools wheel && pip3 install -e .
ENV XDG_CACHE_HOME=/cache
ENTRYPOINT []
CMD ["./entrypoint.sh"]
VOLUME ["/usr/local/share/ca-certificates"]
ENTRYPOINT ["./entrypoint.sh"]
CMD []

View File

@ -1,11 +1,38 @@
#!/bin/sh
# Dump all env vars so we can source them in cron jobs
printenv | sed 's/^\(.*\)$/export \1/g' > /env.sh
set -e
# Write crontab
rcb crontab > crontab
setup_cacerts(){
# start cron in the foreground
crontab crontab
crond -f
update-ca-certificates
}
dump_env(){
# Dump all env vars so we can source them in cron jobs
printenv | sed 's/^\(.*\)$/export \1/g' > /env.sh
}
setup_crontab(){
# Write crontab
rcb crontab > crontab
# start cron in the foreground
crontab crontab
crond -f
}
start_app(){
setup_cacerts
if [ "$1" = '' ]; then
dump_env
setup_crontab
else
exec "$@"
fi
}
start_app "$@"