1
0
mirror of https://github.com/xzeldon/vwdump.git synced 2025-06-28 06:18:15 +03:00

Merge branch 'dev' into 'master'

Merge from dev into master

Closes #14

See merge request 1O/bitwarden_rs-backup!5
This commit is contained in:
Markus 2021-01-25 17:03:42 +00:00
commit 4a9a59d7e3
3 changed files with 41 additions and 41 deletions

View File

@ -2,11 +2,13 @@ stages:
- build:docker - build:docker
variables: variables:
IMAGE_NAME: "$CI_REGISTRY_IMAGE"
IMAGE_NAME_DOCKERHUB: "index.docker.io/bruceforce/bw_backup" IMAGE_NAME_DOCKERHUB: "index.docker.io/bruceforce/bw_backup"
# see https://gitlab.com/gitlab-org/gitlab-runner/issues/4501 # see https://gitlab.com/gitlab-org/gitlab-runner/issues/4501
DOCKER_DRIVER: overlay2 DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: "/certs" DOCKER_TLS_CERTDIR: "/certs"
# See https://github.com/docker/buildx/releases
BUILDX_VERSION: v0.5.1
BUILDX_ARCH: linux-amd64
.docker_login: &docker_login .docker_login: &docker_login
docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
@ -18,37 +20,29 @@ variables:
stage: build:docker stage: build:docker
image: docker:latest image: docker:latest
services: services:
- docker:dind - name: docker:dind
command: ["--experimental"]
tags: tags:
- shared - shared
before_script:
- apk add curl
- mkdir -p ~/.docker/cli-plugins
- curl -sSLo ~/.docker/cli-plugins/docker-buildx https://github.com/docker/buildx/releases/download/$BUILDX_VERSION/buildx-$BUILDX_VERSION.$BUILDX_ARCH
- chmod +x ~/.docker/cli-plugins/docker-buildx
- docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
- docker context create my-context
- docker buildx create --use my-context
- docker info
build_master: build_master:
<<: *docker_build <<: *docker_build
script: script:
- *docker_login - *docker_login
- docker build --pull -t "$IMAGE_NAME" -t "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" .
- docker push "$IMAGE_NAME"
- *dockerhub_login - *dockerhub_login
- docker push "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" #- docker build --pull -t "$IMAGE_NAME" -t "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" .
only: - docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -t "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG:-latest}" -t "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" .
refs: #- docker push "$IMAGE_NAME"
- master #- docker push "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}"
- tags
changes:
- Dockerfile
- backup.sh
- entrypoint.sh
build_master_rpi3:
<<: *docker_build
script:
- *docker_login
- docker build --pull -t "$IMAGE_NAME:rpi3" -t "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}-rpi3" .
- docker push "$IMAGE_NAME:rpi3"
- *dockerhub_login
- docker push "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}-rpi3"
tags:
- rpi3
only: only:
refs: refs:
- master - master
@ -62,8 +56,9 @@ build:
<<: *docker_build <<: *docker_build
script: script:
- *docker_login - *docker_login
- docker build --pull -t "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/bw_backup:${CI_COMMIT_TAG:-latest}" . #- docker build --pull -t "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/bw_backup:${CI_COMMIT_TAG:-latest}" .
- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/bw_backup:${CI_COMMIT_TAG:-latest}" - docker buildx build --push --platform linux/arm/v7,linux/arm64/v8,linux/amd64 --tag "$CI_REGISTRY_IMAGE:$CI_COMMIT_REF_NAME" .
#- docker push "$CI_REGISTRY_IMAGE/$CI_COMMIT_REF_SLUG/bw_backup:${CI_COMMIT_TAG:-latest}"
except: except:
- master - master

View File

@ -1,11 +1,13 @@
FROM alpine:latest ARG ARCH=
FROM ${ARCH}alpine:latest
RUN addgroup -S app && adduser -S -G app app RUN addgroup -S app && adduser -S -G app app
RUN apk add --no-cache \ RUN apk add --no-cache \
sqlite \ sqlite \
busybox-suid \ busybox-suid \
su-exec su-exec \
tzdata
ENV DB_FILE /data/db.sqlite3 ENV DB_FILE /data/db.sqlite3
ENV BACKUP_FILE /data/db_backup/backup.sqlite3 ENV BACKUP_FILE /data/db_backup/backup.sqlite3

View File

@ -40,20 +40,22 @@ docker run --rm --volumes-from=bitwarden -e UID=0 -e BACKUP_FILE=/myBackup/backu
``` ```
## Environment variables ## Environment variables
| ENV | Description | | ENV | Description |
| ----- | ----- | | ----------------------- | ------------------------------------------------------------------------ |
| DB_FILE | Path to the Bitwarden sqlite3 database *inside* the container | | DB_FILE | Path to the Bitwarden sqlite3 database *inside* the container |
| BACKUP_FILE | Path to the desired backup location *inside* the container | | BACKUP_FILE | Path to the desired backup location *inside* the container |
| BACKUP_FILE_PERMISSIONS | Sets the permissions of the backup file (**CAUTION** [^1]) | | BACKUP_FILE_PERMISSIONS | Sets the permissions of the backup file (**CAUTION** [^1]) |
| CRON_TIME | Cronjob format "Minute Hour Day_of_month Month_of_year Day_of_week Year" | | CRON_TIME | Cronjob format "Minute Hour Day_of_month Month_of_year Day_of_week Year" |
| TIMESTAMP | Set to `true` to append timestamp to the `BACKUP_FILE` | | TIMESTAMP | Set to `true` to append timestamp to the `BACKUP_FILE` |
| UID | User ID to run the cron job with | | UID | User ID to run the cron job with |
| GID | Group ID to run the cron job with | | GID | Group ID to run the cron job with |
| LOGFILE | Path to the logfile *inside* the container | | LOGFILE | Path to the logfile *inside* the container |
| CRONFILE | Path to the cron file *inside* the container | | CRONFILE | Path to the cron file *inside* the container |
| DELETE_AFTER | Delete old backups after X many days | | DELETE_AFTER | Delete old backups after X many days |
| TZ | Set the timezone inside the container [^2]
[^1]: The permissions should at least be 700 since the backup folder itself gets the same permissions and with 600 it would not be accessible. [^1]: The permissions should at least be 700 since the backup folder itself gets the same permissions and with 600 it would not be accessible.
[^2]: see <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones> for more information
## Common erros ## Common erros
### Wrong permissions ### Wrong permissions
@ -64,4 +66,5 @@ via the `UID` and `GID` environment variables like described above.
### Wrong timestamp ### Wrong timestamp
If you need timestamps in your local timezone you should mount `/etc/timezone:/etc/timezone:ro` and `/etc/localtime:/etc/localtime:ro` If you need timestamps in your local timezone you should mount `/etc/timezone:/etc/timezone:ro` and `/etc/localtime:/etc/localtime:ro`
like it's done in the [docker-compose.yml](docker-compose.yml). like it's done in the [docker-compose.yml](docker-compose.yml). An other possible solution is to set the environment variable accordingly (like `TZ=Europe/Berlin`)
(see <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones> for more information).