4 Commits

5 changed files with 31 additions and 11 deletions

View File

@@ -3,7 +3,7 @@
```yaml
services:
sqlite_backup:
image: hub.realmanual.ru/pub/sqlite-backup/backup:latest
image: git.realmanual.ru/pub/sqlite-backup-s3
container_name: sqlite_backup
restart: always
volumes:

View File

@@ -1,6 +1,9 @@
#!/bin/bash
DOCKER_BASEIMAGE=alpine:latest
TAG=$1
docker buildx build --platform linux/amd64,linux/arm64 --push -t hub.realmanual.ru/pub/sqlite-backup \
--build-arg DOCKER_BASEIMAGE=${DOCKER_BASEIMAGE} .
if [ -z "$TAG" ]; then
TAG=latest
fi
docker buildx build --platform linux/amd64,linux/arm64 --push -t git.realmanual.ru/pub/sqlite-backup:${TAG} .

View File

@@ -1,6 +1,6 @@
services:
sqlite_backup:
image: hub.realmanual.ru/pub/sqlite-backup/backup:latest
image: git.realmanual.ru/pub/sqlite-backup/backup:latest
container_name: sqlite_backup
restart: always
volumes:

View File

@@ -1,6 +1,8 @@
#!/bin/sh
echo "${CRONTAB} /scripts/backup.sh" > /etc/crontabs/root
# Create crontab in a writable location
mkdir -p /tmp/crontabs
echo "${CRONTAB} /scripts/backup.sh" > /tmp/crontabs/root
/scripts/backup.sh
exec crond -f
exec crond -f -c /tmp/crontabs

View File

@@ -1,18 +1,33 @@
#!/bin/bash
rclone config create myminio s3 provider Minio access_key_id $MINIO_ACCOUNT_ID secret_access_key $MINIO_APPLICATION_KEY endpoint $MINIO_ENDPOINT region $MINIO_LOCATION acl private
# Create rclone config on-the-fly in a writable location
RCLONE_CONFIG_DIR="/tmp/rclone"
mkdir -p "$RCLONE_CONFIG_DIR"
export RCLONE_CONFIG="$RCLONE_CONFIG_DIR/rclone.conf"
cat > "$RCLONE_CONFIG" << EOF
[myminio]
type = s3
provider = Minio
access_key_id = $MINIO_ACCOUNT_ID
secret_access_key = $MINIO_APPLICATION_KEY
endpoint = $MINIO_ENDPOINT
region = $MINIO_LOCATION
acl = private
no_check_bucket = true
EOF
case $1 in
copy)
echo "copy from $2 to $3"
rclone copy --progress $2 $3
rclone copy --progress $2 myminio:$3
;;
list)
echo "list $2"
rclone ls $2
rclone ls myminio:$2
;;
delete)
echo "delete $2"
rclone delete $2
rclone delete myminio:$2
;;
esac