Compare commits
15 Commits
Author | SHA1 | Date | |
---|---|---|---|
63f6f969cc
|
|||
03fa82b223
|
|||
235b1a10d8
|
|||
1a01c67759
|
|||
a45b2cfc60
|
|||
2b47398f95
|
|||
f04c1ec1b9
|
|||
ca72a0c8f9
|
|||
7219caa4ff
|
|||
2cd46e37ef
|
|||
7c8bfad01f
|
|||
4821316ee9
|
|||
798cd355b2
|
|||
eab152e928
|
|||
60e7136bcd
|
@@ -13,6 +13,10 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
name: Build image
|
name: Build image
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
container: catthehacker/ubuntu:act-latest
|
||||||
|
env:
|
||||||
|
REGISTRY: git.realmanual.ru
|
||||||
|
IMAGE_NAME: ${{ gitea.repository }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -20,21 +24,16 @@ jobs:
|
|||||||
- name: Log in to the Container registry
|
- name: Log in to the Container registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
with:
|
with:
|
||||||
registry: git.realmanual.ru
|
registry: ${{ env.REGISTRY }}
|
||||||
username: ${{ gitea.actor }}
|
username: ${{ gitea.actor }}
|
||||||
password: ${{ secrets.PUSH_TOKEN }}
|
password: ${{ secrets.PUSH_TOKEN }}
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v5
|
|
||||||
with:
|
|
||||||
images: ${{ gitea.repository }}
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
id: push
|
id: push
|
||||||
uses: docker/build-push-action@v6
|
uses: docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
push: true
|
push: true
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
tags: |
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ gitea.ref_name }}
|
||||||
|
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
|
||||||
|
@@ -3,7 +3,7 @@
|
|||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
sqlite_backup:
|
sqlite_backup:
|
||||||
image: hub.realmanual.ru/pub/sqlite-backup/backup:latest
|
image: git.realmanual.ru/pub/sqlite-backup-s3
|
||||||
container_name: sqlite_backup
|
container_name: sqlite_backup
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
@@ -1,6 +1,9 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
DOCKER_BASEIMAGE=alpine:latest
|
TAG=$1
|
||||||
|
|
||||||
docker buildx build --platform linux/amd64,linux/arm64 --push -t hub.realmanual.ru/pub/sqlite-backup \
|
if [ -z "$TAG" ]; then
|
||||||
--build-arg DOCKER_BASEIMAGE=${DOCKER_BASEIMAGE} .
|
TAG=latest
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker buildx build --platform linux/amd64,linux/arm64 --push -t git.realmanual.ru/pub/sqlite-backup:${TAG} .
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
services:
|
services:
|
||||||
sqlite_backup:
|
sqlite_backup:
|
||||||
image: hub.realmanual.ru/pub/sqlite-backup/backup:latest
|
image: git.realmanual.ru/pub/sqlite-backup/backup:latest
|
||||||
container_name: sqlite_backup
|
container_name: sqlite_backup
|
||||||
restart: always
|
restart: always
|
||||||
volumes:
|
volumes:
|
||||||
|
@@ -1,6 +1,17 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
echo "${CRONTAB} /scripts/backup.sh" > /etc/crontabs/root
|
# Create crontab in a writable location and set proper permissions
|
||||||
|
mkdir -p /tmp/crontabs
|
||||||
|
echo "${CRONTAB:-"0 * * * *"} /scripts/backup.sh" > /tmp/crontabs/root
|
||||||
|
chmod 644 /tmp/crontabs/root
|
||||||
|
|
||||||
|
# Run initial backup
|
||||||
/scripts/backup.sh
|
/scripts/backup.sh
|
||||||
exec crond -f
|
|
||||||
|
# Start crond with debug output
|
||||||
|
echo "Starting crond with config:"
|
||||||
|
cat /tmp/crontabs/root
|
||||||
|
echo "---"
|
||||||
|
|
||||||
|
# Start crond in foreground with debug output
|
||||||
|
exec crond -f -c /tmp/crontabs -d 8
|
||||||
|
@@ -1,6 +1,21 @@
|
|||||||
#!/bin/bash
|
#!/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
|
case $1 in
|
||||||
copy)
|
copy)
|
||||||
@@ -8,11 +23,11 @@ case $1 in
|
|||||||
rclone copy --progress $2 $3
|
rclone copy --progress $2 $3
|
||||||
;;
|
;;
|
||||||
list)
|
list)
|
||||||
echo "list $2"
|
echo "list ${MINIO_PATH}/$2"
|
||||||
rclone ls $2
|
rclone ls ${MINIO_PATH}/$2
|
||||||
;;
|
;;
|
||||||
delete)
|
delete)
|
||||||
echo "delete $2"
|
echo "delete ${MINIO_PATH}/$2"
|
||||||
rclone delete $2
|
rclone delete ${MINIO_PATH}/$2
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
Reference in New Issue
Block a user