This commit is contained in:
57
.drone.yml
Normal file
57
.drone.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
kind: pipeline
|
||||
type: kubernetes
|
||||
name: build
|
||||
|
||||
steps:
|
||||
- name: build
|
||||
image: tomkukral/buildah:0.27
|
||||
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/homeassistant"
|
||||
commands:
|
||||
- |
|
||||
HASS_VERSION=$$(grep FROM 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 --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 push $${RELEASE_IMAGE_NAME}:$${DRONE_COMMIT_SHA} docker://$${RELEASE_IMAGE_NAME}:latest
|
||||
podman logout "$${REGISTRY_SERVER}"
|
||||
volumes:
|
||||
- name: containers
|
||||
path: /var/lib/containers
|
||||
when:
|
||||
branch:
|
||||
- master
|
||||
|
||||
- name: cleanup
|
||||
image: tomkukral/buildah:0.27
|
||||
privileged: true
|
||||
environment:
|
||||
RELEASE_IMAGE_NAME: "docker.io/genunix/homeassistant"
|
||||
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
|
||||
|
||||
volumes:
|
||||
- name: containers
|
||||
host:
|
||||
path: /var/lib/containers
|
||||
Reference in New Issue
Block a user