try to implement the global containerization
This commit is contained in:
1 parent
e2b471312c
commit
ed38086d09
24 files changed
+966
No files matched your search
Executable
+14
@@ -0,0 +1,14 @@
|
||||
FROM alpine:latest
|
||||
|
||||
RUN apk add --no-cache mariadb-client bash dcron
|
||||
|
||||
RUN mkdir -p /backups
|
||||
RUN mkdir -p /etc/periodic/daily
|
||||
|
||||
COPY backup_db.sh /etc/periodic/daily/backup_db
|
||||
COPY entrypoint.sh /entrypoint.sh
|
||||
|
||||
RUN chmod +x /etc/periodic/daily/backup_db
|
||||
RUN chmod +x /entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/entrypoint.sh"]
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
BACKUP_DIR="/backups"
|
||||
|
||||
mkdir -p "$BACKUP_DIR"
|
||||
|
||||
DAY=$(date +%d)
|
||||
FILE="$BACKUP_DIR/$DAY.sql"
|
||||
|
||||
mysqldump -h mariadb -u "$DB_USERNAME" -p"$DB_PASSWORD" "$DB_DATABASE" > "$FILE" 2>/dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "[$(date)] Backup $DB_DATABASE sauvegardé dans $FILE" >> "$BACKUP_DIR/backup.log"
|
||||
else
|
||||
echo "[$(date)] ERREUR lors du backup de $DB_DATABASE" >> "$BACKUP_DIR/backup.log"
|
||||
fi
|
||||
Executable
+2
@@ -0,0 +1,2 @@
|
||||
#!/bin/sh
|
||||
crond -f -l 2
|
||||
Reference in new issue
Block a user