diff --git a/.gitea/ docker-image.deploy.yml b/.gitea/ docker-image.deploy.yml new file mode 100644 index 0000000..3d421aa --- /dev/null +++ b/.gitea/ docker-image.deploy.yml @@ -0,0 +1,32 @@ +on: + push: + paths: + - "docker/**" + - ".gitea/**" + schedule: + - cron: "0 02 * * *" +jobs: + + build-docker-image: + runs-on: ubuntu-latest + + steps: + + - name: Checkout code + uses: actions/checkout@v2 + + - name: Log in to git.limbosolutions.com docker registry + uses: docker/login-action@v3 + with: + registry: git.limbosolutions.com + username: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_USERNAME }} + password: ${{ secrets.GITLIMBO_DOCKER_REGISTRY_PASSWORD }} + + - name: Build and push Docker images + id: push + uses: docker/build-push-action@v6 + with: + context: . + file: ${{gitea.workspace}}/docker/Dockerfile + push: true + tags: git.limbosolutions.com/kb/borg-backup \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..621cb7b --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +**.local.** diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..4abe377 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,6 @@ +{ + "cSpell.words": [ + "ffenv", + "GITLIMBO" + ] +} \ No newline at end of file diff --git a/docker-compose.dev.yml b/docker-compose.dev.yml new file mode 100644 index 0000000..973b5de --- /dev/null +++ b/docker-compose.dev.yml @@ -0,0 +1,15 @@ +# image: #"git.limbosolutions.com/kb/borg:latest" + +services: + borg: + build: + dockerfile: /docker/dockerfile + context: . + environment: + - BORG_REPO=${BORG_REPO} + - BORG_RSH=${BORG_RSH} + - BORG_PASSPHRASE=${BORG_PASSPHRASE} + - SSH_ID=${SSH_ID} + - BORG_KEY=${BORG_KEY} + + diff --git a/docker/Dockerfile b/docker/Dockerfile new file mode 100644 index 0000000..70601c2 --- /dev/null +++ b/docker/Dockerfile @@ -0,0 +1,18 @@ +FROM ubuntu:latest + + +RUN apt-get update + + +RUN apt-get install -y \ + python3 \ + python3-pip \ + borgbackup \ + fuse \ + python3-pyfuse3 \ + openssh-client + +COPY ./docker/app /app +RUN chmod +x /app/scripts/ffenv +RUN ln -s /app/scripts/ffenv /usr/local/lib/ffenv + diff --git a/docker/app/scripts/ffenv b/docker/app/scripts/ffenv new file mode 100644 index 0000000..2eaab7e --- /dev/null +++ b/docker/app/scripts/ffenv @@ -0,0 +1,19 @@ +#!/bin/bash +echo "checking SSH_ID..." +if [[ "${SSH_ID}" ]]; then + echo "found SSH_ID..." + mkdir -p /root/.ssh + echo "${SSH_ID}" > /root/.ssh/id_rsa + chmod 700 /root/.ssh/id_rsa +fi +echo "checking BORG_KEY..." +if [[ "${BORG_KEY}" ]]; then + echo "found BORG_KEY..." + mkdir -p /root/.config/borg/keys + echo "${BORG_KEY}" > /root/.config/borg/keys/key +fi + + + + +