version: "3.9"
services:
  init:
    image: alpine:latest
    user: "root"
    group_add:
      - '${GROUP_ID}'
    volumes:
      - ${OUTDIR}:/backup
    command: chown -R ${USER_ID}:${USER_ID} /backup

  kleingebaeck:
    container_name: kleingebaeck
    user: "${USER_ID}:${USER_ID}"
    volumes:
      - ${OUTDIR}:/backup
    working_dir: /backup
    build: .
    image: kleingebaeck:latest
    depends_on:
      init:
        condition: service_completed_successfully
