diff --git a/docker/backup/Dockerfile b/docker/backup/Dockerfile index 3fb91ea..fc319b8 100644 --- a/docker/backup/Dockerfile +++ b/docker/backup/Dockerfile @@ -1,13 +1,15 @@ -FROM python:3.12 +FROM mysql:8.4 -# Install MySQL client. -RUN apt-get update && apt-get install -y mariadb-client +# Use the official MySQL dump client for MySQL generated-column support. +# Install Python and gzip for the S3 client and compressed backups. +RUN microdnf install -y python3-pip gzip && microdnf clean all # Install S3 client. -RUN pip install s3cmd +RUN pip3 install --no-cache-dir s3cmd # Copy files. COPY scripts/backup.sh ./ # Run backup task. -CMD bash backup.sh +ENTRYPOINT [] +CMD ["bash", "backup.sh"] diff --git a/scripts/backup.sh b/scripts/backup.sh index 13eaa5d..c59f702 100644 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -5,7 +5,7 @@ while true; do SQL_FILE=$(date '+%Y-%m-%d.%H').sql.gz # Dump and compress database in one stream - mysqldump --no-tablespaces -h ${MYSQL_HOST:=127.0.0.1} -u ${MYSQL_USER:=gorse} -p${MYSQL_PASSWORD:=gorse_pass} --ssl-verify-server-cert=0 ${MYSQL_DATABASE:=gorse} users items feedback flask_dance_oauth | gzip > $SQL_FILE + mysqldump --no-tablespaces -h ${MYSQL_HOST:=127.0.0.1} -u ${MYSQL_USER:=gorse} -p${MYSQL_PASSWORD:=gorse_pass} --ssl-mode=PREFERRED ${MYSQL_DATABASE:=gorse} users items feedback flask_dance_oauth | gzip > $SQL_FILE # Upload SQL file s3cmd --access_key=$S3_ACCESS_KEY \