All checks were successful
continuous-integration/drone/push Build is passing
58 lines
1.7 KiB
YAML
58 lines
1.7 KiB
YAML
---
|
|
kind: pipeline
|
|
type: kubernetes
|
|
name: build
|
|
|
|
steps:
|
|
- name: build
|
|
image: mgoltzsche/podman:5.2.5
|
|
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 --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:
|
|
- main
|
|
|
|
- name: cleanup
|
|
image: mgoltzsche/podman:5.2.5
|
|
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:
|
|
- main
|
|
|
|
trigger:
|
|
event:
|
|
- push
|
|
- custom
|
|
|
|
volumes:
|
|
- name: containers
|
|
host:
|
|
path: /var/lib/containers
|