Compare commits
9 Commits
6f72c80511
...
0.1.1
| Author | SHA1 | Date | |
|---|---|---|---|
| fd222fc92a | |||
| bbc5245793 | |||
| cacd0086c1 | |||
| d13c54c8df | |||
| 874adb4e2e | |||
| f5d9f0e458 | |||
| 3a838a92f9 | |||
| 1d8c32eac3 | |||
| dd9d6feb57 |
@@ -1,15 +1,16 @@
|
||||
name: Build and Push Docker Image
|
||||
name: Docker Image CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
pull_request:
|
||||
- "main"
|
||||
tags:
|
||||
- "*" # This triggers the workflow on any tag push
|
||||
|
||||
jobs:
|
||||
build:
|
||||
build-and-push-image:
|
||||
runs-on: prodesk
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
@@ -17,19 +18,35 @@ jobs:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Log in to Gitea Docker Registry
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: gitea.calahilstudios.com
|
||||
username: ${{ secrets.REGISTRY_USER }}
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Build and push image
|
||||
- name: Prepare tags
|
||||
id: prepare_tags
|
||||
run: |
|
||||
# The image reference for your Gitea registry
|
||||
IMAGE_REF=gitea.calahilstudios.com/calahil/backupbot
|
||||
|
||||
# The main tags: latest and commit SHA
|
||||
TAGS="${IMAGE_REF}:latest,${IMAGE_REF}:${{ gitea.sha }}"
|
||||
|
||||
# If the event is a tag push, add the git tag as a tag
|
||||
if [[ "${{ gitea.ref_type }}" == "tag" ]]; then
|
||||
GIT_TAG_NAME=$(basename "${{ gitea.ref }}")
|
||||
TAGS="${TAGS},${IMAGE_REF}:${GIT_TAG_NAME}"
|
||||
fi
|
||||
|
||||
# Set the tags as a step output
|
||||
echo "DOCKER_TAGS=${TAGS}" >> $GITEA_ENV
|
||||
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
push: true
|
||||
tags: |
|
||||
gitea.calahilstudios.com/${{ github.repository_owner }}/${{ github.event.repository.name }}:develop
|
||||
gitea.calahilstudios.com/${{ github.repository_owner }}/${{ github.event.repository.name }}:${{ github.sha }}
|
||||
tags: ${{ steps.prepare_tags.outputs.DOCKER_TAGS }}
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
|
||||
[](https://www.gnu.org/licenses/agpl-3.0)
|
||||
[](https://www.docker.com/)
|
||||
[](https://gitea.calahilstudios.com/owner/backupbot)
|
||||
[](https://gitea.calahilstudios.com)
|
||||

|
||||

|
||||
|
||||
[](https://hub.docker.com/r/linuxserver/duplicati)
|
||||
[](https://hub.docker.com/r/linuxserver/duplicati)
|
||||
|
||||
> **Automated Docker backup system for PostgreSQL databases and application configurations with Duplicati integration**
|
||||
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
TZ=America/Los_Angeles
|
||||
BACKUP_DIR=/backups/postgres
|
||||
LOG_FILE=/config/log/pgbackup.log
|
||||
MAX_RETRIES=3
|
||||
GOTIFY_URL=http://gotify.example.com
|
||||
GOTIFY_TOKEN=your_gotify_token_here
|
||||
BACKUP_HOUR=03
|
||||
BACKUP_MINUTE=00
|
||||
@@ -1,50 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import cgi
|
||||
import cgitb
|
||||
import os
|
||||
import json
|
||||
|
||||
cgitb.enable()
|
||||
print("Content-Type: application/json\n")
|
||||
|
||||
ENV_FILE = "/config/web/backupbot.env"
|
||||
|
||||
|
||||
def read_env():
|
||||
env = {}
|
||||
if os.path.exists(ENV_FILE):
|
||||
with open(ENV_FILE) as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line or line.startswith("#") or "=" not in line:
|
||||
continue
|
||||
key, val = line.split("=", 1)
|
||||
key = key.strip()
|
||||
val = val.strip().split("#")[0].strip() # strip inline comments
|
||||
env[key] = val
|
||||
return env
|
||||
|
||||
|
||||
def write_env(env):
|
||||
with open(ENV_FILE, "w") as f:
|
||||
for key, val in env.items():
|
||||
f.write(f"{key}={val}\n")
|
||||
|
||||
|
||||
form = cgi.FieldStorage()
|
||||
action = form.getvalue("action")
|
||||
|
||||
if action == "get":
|
||||
env = read_env()
|
||||
print(json.dumps(env))
|
||||
elif action == "set":
|
||||
try:
|
||||
raw = os.environ.get("CONTENT_LENGTH")
|
||||
length = int(raw) if raw else 0
|
||||
data = json.loads(os.read(0, length))
|
||||
write_env(data)
|
||||
print(json.dumps({"status": "ok", "message": "Configuration saved."}))
|
||||
except Exception as e:
|
||||
print(json.dumps({"status": "error", "message": str(e)}))
|
||||
else:
|
||||
print(json.dumps({"status": "error", "message": "Invalid action"}))
|
||||
Reference in New Issue
Block a user