diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bd8219d..a4125ac 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,16 @@ stages: + - push:readme - build:docker +workflow: + rules: + - if: '$CI_PIPELINE_SOURCE == "push"' + - if: $CI_COMMIT_TAG + variables: - IMAGE_NAME_DOCKERHUB: "index.docker.io/bruceforce/bw_backup" + DOCKERHUB_REGISTRY: index.docker.io + DOCKERHUB_REPO: bw_backup + IMAGE_NAME_DOCKERHUB: $DOCKERHUB_REGISTRY/$DOCKERHUB_USER/$DOCKERHUB_REPO # see https://gitlab.com/gitlab-org/gitlab-runner/issues/4501 DOCKER_DRIVER: overlay2 DOCKER_TLS_CERTDIR: "/certs" @@ -34,31 +42,58 @@ variables: - docker buildx create --use my-context - docker info +push_readme: + stage: push:readme + image: docker:latest + services: + - docker:dind + tags: + - shared + script: + - docker run + -v $(pwd)/README.md:/data/README.md:ro + -e DOCKER_USER=$DOCKERHUB_USER + -e DOCKER_PASS=$DOCKERHUB_PASSWORD + -e PUSHRM_FILE=/data/README.md + -e PUSHRM_TARGET=docker.io/$DOCKERHUB_USER/$DOCKERHUB_REPO + chko/docker-pushrm + rules: + - if: '$CI_COMMIT_BRANCH == "master"' + changes: + - README.md + build_master: <<: *docker_build script: - *docker_login - *dockerhub_login #- 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 buildx build + --push + --platform linux/arm/v7,linux/arm64/v8,linux/amd64 + --tag "$CI_REGISTRY_IMAGE:${CI_COMMIT_TAG:-latest}" + --tag "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" . #- docker push "$IMAGE_NAME" #- docker push "$IMAGE_NAME_DOCKERHUB:${CI_COMMIT_TAG:-latest}" - only: - refs: - - master - - tags - changes: - - Dockerfile - - backup.sh - - entrypoint.sh + rules: + - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG' + changes: + - Dockerfile + - backup.sh + - entrypoint.sh build: <<: *docker_build script: - *docker_login #- 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 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 + rules: + - if: '$CI_COMMIT_BRANCH == "master" || $CI_COMMIT_TAG' + when: never + - when: on_success diff --git a/README.md b/README.md index 7826832..4ba8763 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,9 @@ Note that sqlite3 creates a lock file in the source directory while running the So source *AND* destination have to be +rw for the user. You can set the user and group ID via the `UID` and `GID` environment variables like described above. -### Wrong timestamp +### Date Time issues / 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). An other possible solution is to set the environment variable accordingly (like `TZ=Europe/Berlin`) (see for more information). + +**Attention** if you are on an ARM based platform please note that [alpine](https://alpinelinux.org/) is used as base image for this project to keep things small. Since alpine 3.13 and above it's possible that you will end up with a container with broken time and date settings (i.e. year 1900). This is a known problem in the alpine project (see [Github issue](https://github.com/alpinelinux/docker-alpine/issues/141) and [solution](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#time64_requirements)) and there is nothing I can do about it. However in the [alpine wiki](https://wiki.alpinelinux.org/wiki/Release_Notes_for_Alpine_3.13.0#time64_requirements) a solution is being proposed which I also tested tested on my raspberry pi. After following the described process it started working again as expected. If you still experience issues or could for some reason not apply the aforementioned fixes please feel free to open an issue. \ No newline at end of file