mirror of
https://github.com/xzeldon/vwdump.git
synced 2025-06-28 20: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:
commit
4a9a59d7e3
@ -2,11 +2,13 @@ stages:
|
||||
- build:docker
|
||||
|
||||
variables:
|
||||
IMAGE_NAME: "$CI_REGISTRY_IMAGE"
|
||||
IMAGE_NAME_DOCKERHUB: "index.docker.io/bruceforce/bw_backup"
|
||||
# see https://gitlab.com/gitlab-org/gitlab-runner/issues/4501
|
||||
DOCKER_DRIVER: overlay2
|
||||
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 -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
|
||||
@ -18,37 +20,29 @@ variables:
|
||||
stage: build:docker
|
||||
image: docker:latest
|
||||
services:
|
||||
- docker:dind
|
||||
- name: docker:dind
|
||||
command: ["--experimental"]
|
||||
tags:
|
||||
- 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:
|
||||
<<: *docker_build
|
||||
script:
|
||||
- *docker_login
|
||||
- docker build --pull -t "$IMAGE_NAME" -t "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" .
|
||||
- docker push "$IMAGE_NAME"
|
||||
- *dockerhub_login
|
||||
- docker push "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}"
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
- 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
|
||||
#- docker build --pull -t "$IMAGE_NAME" -t "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" .
|
||||
- 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}" .
|
||||
#- docker push "$IMAGE_NAME"
|
||||
#- docker push "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}"
|
||||
only:
|
||||
refs:
|
||||
- master
|
||||
@ -62,8 +56,9 @@ build:
|
||||
<<: *docker_build
|
||||
script:
|
||||
- *docker_login
|
||||
- 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 build --pull -t "$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:
|
||||
- master
|
||||
|
||||
|
@ -1,11 +1,13 @@
|
||||
FROM alpine:latest
|
||||
ARG ARCH=
|
||||
FROM ${ARCH}alpine:latest
|
||||
|
||||
RUN addgroup -S app && adduser -S -G app app
|
||||
|
||||
RUN apk add --no-cache \
|
||||
sqlite \
|
||||
busybox-suid \
|
||||
su-exec
|
||||
su-exec \
|
||||
tzdata
|
||||
|
||||
ENV DB_FILE /data/db.sqlite3
|
||||
ENV BACKUP_FILE /data/db_backup/backup.sqlite3
|
||||
|
29
README.md
29
README.md
@ -40,20 +40,22 @@ docker run --rm --volumes-from=bitwarden -e UID=0 -e BACKUP_FILE=/myBackup/backu
|
||||
```
|
||||
|
||||
## Environment variables
|
||||
| ENV | Description |
|
||||
| ----- | ----- |
|
||||
| DB_FILE | Path to the Bitwarden sqlite3 database *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]) |
|
||||
| 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` |
|
||||
| UID | User ID to run the cron job with |
|
||||
| GID | Group ID to run the cron job with |
|
||||
| LOGFILE | Path to the logfile *inside* the container |
|
||||
| CRONFILE | Path to the cron file *inside* the container |
|
||||
| DELETE_AFTER | Delete old backups after X many days |
|
||||
| ENV | Description |
|
||||
| ----------------------- | ------------------------------------------------------------------------ |
|
||||
| DB_FILE | Path to the Bitwarden sqlite3 database *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]) |
|
||||
| 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` |
|
||||
| UID | User ID to run the cron job with |
|
||||
| GID | Group ID to run the cron job with |
|
||||
| LOGFILE | Path to the logfile *inside* the container |
|
||||
| CRONFILE | Path to the cron file *inside* the container |
|
||||
| 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.
|
||||
[^2]: see <https://en.wikipedia.org/wiki/List_of_tz_database_time_zones> for more information
|
||||
|
||||
## Common erros
|
||||
### Wrong permissions
|
||||
@ -64,4 +66,5 @@ via the `UID` and `GID` environment variables like described above.
|
||||
|
||||
### Wrong timestamp
|
||||
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).
|
||||
|
Loading…
x
Reference in New Issue
Block a user