Files
restic/.drone.yml
Filip Pytloun e4c0e62e0c
All checks were successful
continuous-integration/drone Build is passing
Add CI
2024-03-31 14:24:54 +02:00

58 lines
1.7 KiB
YAML

---
kind: pipeline
type: kubernetes
name: build
steps:
- name: build
image: mgoltzsche/podman:4.9.4
privileged: true
environment:
REGISTRY_USERNAME:
from_secret: registry_username
REGISTRY_PASSWORD:
from_secret: registry_password
REGISTRY_SERVER: "docker.io"
RELEASE_IMAGE_NAME: "docker.io/genunix/restic"
commands:
- |
RESTIC_VERSION=$$(grep RESTIC_VERSION Dockerfile|cut -d = -f 2)
podman login --username "$${REGISTRY_USERNAME}" --password "$${REGISTRY_PASSWORD}" "$${REGISTRY_SERVER}"
echo "== Building $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}"
podman build --platform linux/arm64/v8 --platform linux/amd64 --pull-always --format docker -t $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} .
echo "== Publishing $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}"
podman push $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} docker://$${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}
podman push $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} docker://$${RELEASE_IMAGE_NAME}:$${HASS_VERSION}
podman logout "$${REGISTRY_SERVER}"
volumes:
- name: containers
path: /var/lib/containers
when:
branch:
- master
- name: cleanup
image: mgoltzsche/podman:4.9.4
privileged: true
environment:
RELEASE_IMAGE_NAME: "docker.io/genunix/restic"
commands:
- podman rmi -f $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA}
- podman image prune -f
volumes:
- name: containers
path: /var/lib/containers
when:
branch:
- master
trigger:
event:
- push
- custom
volumes:
- name: containers
host:
path: /var/lib/containers