kopia lustrzana https://github.com/Ovski4/docker-borgbackup-cron
Clone the playbooks during the build rather than during container initialization
rodzic
8567b17869
commit
0fcc672ac3
|
@ -1,5 +1,9 @@
|
|||
FROM ovski/ansible:v2.7.8
|
||||
|
||||
# Clone ansible playbooks
|
||||
RUN git clone https://gitlab.com/ovski-projects/infra/ansible-playbooks/borg-backup.git /var/borg-backup-playbook
|
||||
RUN git clone https://gitlab.com/ovski-projects/infra/ansible-playbooks/mysql-dump.git /var/mysql-dump-playbook
|
||||
|
||||
# Install borg
|
||||
RUN apt-get install -y \
|
||||
python3 \
|
||||
|
@ -13,7 +17,7 @@ RUN apt-get install -y \
|
|||
|
||||
# Install packages for mysqldump
|
||||
RUN apt-get install -y mysql-client
|
||||
RUN pip install PyMySql
|
||||
RUN pip3 install PyMySql
|
||||
|
||||
# Install cron
|
||||
RUN apt-get install -y cron
|
||||
|
@ -25,6 +29,7 @@ COPY borgbackup_cron /etc/cron.d/borgbackup_cron
|
|||
RUN chmod +x /etc/cron.d/borgbackup_cron
|
||||
RUN crontab /etc/cron.d/borgbackup_cron
|
||||
|
||||
# Setup entrypoint
|
||||
COPY entrypoint.sh /var/entrypoint.sh
|
||||
RUN chmod +x /var/entrypoint.sh
|
||||
ENTRYPOINT [ "/var/entrypoint.sh" ]
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
set -eo pipefail
|
||||
shopt -s nullglob
|
||||
|
||||
# Add known hosts
|
||||
if [[ -n "$SSH_KNOWN_HOSTS" ]]; then
|
||||
echo "Adding domains and ips to known hosts"
|
||||
mkdir -p ~/.ssh
|
||||
|
@ -15,12 +14,6 @@ if [[ -n "$SSH_KNOWN_HOSTS" ]]; then
|
|||
done <<< "$SSH_KNOWN_HOSTS"
|
||||
fi
|
||||
|
||||
# Clone ansible playbooks
|
||||
echo "Cloning ansible gitlab repositories"
|
||||
git clone https://gitlab.com/ovski-projects/infra/ansible-playbooks/borg-backup.git /var/borg-backup-playbook
|
||||
git clone https://gitlab.com/ovski-projects/infra/ansible-playbooks/mysql-dump.git /var/mysql-dump-playbook
|
||||
|
||||
# Set borg passphrase env variable
|
||||
if [[ -f /run/secrets/borg_passphrase ]]; then
|
||||
echo "Setting BORG_PASSPHRASE env variable from secret"
|
||||
export BORG_PASSPHRASE=$(cat /run/secrets/borg_passphrase)
|
||||
|
|
Ładowanie…
Reference in New Issue