forked from platypush/platypush
[#434] Added pipeline to update registry images.
This commit is contained in:
parent
3680a9b1d1
commit
8bc5e5b8c5
2 changed files with 42 additions and 0 deletions
30
.drone.yml
30
.drone.yml
|
@ -12,6 +12,10 @@ volumes:
|
|||
host:
|
||||
path: /opt/repos/platypush
|
||||
|
||||
- name: docker_sock
|
||||
host:
|
||||
path: /var/run/docker.sock
|
||||
|
||||
steps:
|
||||
|
||||
###
|
||||
|
@ -333,6 +337,31 @@ steps:
|
|||
commands:
|
||||
- . .drone/update-pip-package.sh
|
||||
|
||||
###
|
||||
### Update the Docker image
|
||||
###
|
||||
|
||||
- name: update-image-registry
|
||||
image: alpine
|
||||
privileged: true
|
||||
volumes:
|
||||
- name: docker_sock
|
||||
path: /var/run/docker.sock
|
||||
|
||||
environment:
|
||||
REGISTRY_ENDPOINT: quay.io
|
||||
DOCKER_HOST: "tcp://localhost:2375/"
|
||||
DOCKER_USER: platypush
|
||||
DOCKER_PASS:
|
||||
from_secret: registry_token
|
||||
|
||||
commands:
|
||||
- . .drone/update-image-registry.sh
|
||||
|
||||
when:
|
||||
event:
|
||||
- tag
|
||||
|
||||
###
|
||||
### Checkpoint step that waits for all the package update
|
||||
### steps to complete before proceeding to the next steps.
|
||||
|
@ -351,6 +380,7 @@ steps:
|
|||
# - update-arch-git-package
|
||||
- update-rpm-repo
|
||||
- update-apt-repo
|
||||
- update-image-registry
|
||||
|
||||
commands:
|
||||
- echo "All packages have been successfully updated"
|
||||
|
|
12
.drone/update-image-registry.sh
Executable file
12
.drone/update-image-registry.sh
Executable file
|
@ -0,0 +1,12 @@
|
|||
#!/bin/sh
|
||||
|
||||
export VERSION=$(grep current_version pyproject.toml | sed -r -e "s/.*=\s*['\"]?([^'\"]+)['\"]?\s*$/\1/")
|
||||
export IMAGE_NAME="$REGISTRY_ENDPOINT/$DOCKER_USER/platypush"
|
||||
|
||||
git config --global --add safe.directory /app
|
||||
docker login "$REGISTRY_ENDPOINT" -u "$DOCKER_USER" -p "$DOCKER_PASS"
|
||||
docker build -f Dockerfile.alpine -t "$IMAGE_NAME:$VERSION" .
|
||||
docker tag "$IMAGE_NAME:$VERSION" "$IMAGE_NAME:latest"
|
||||
|
||||
docker push "$IMAGE_NAME:$VERSION"
|
||||
docker push "$IMAGE_NAME:latest"
|
Loading…
Reference in a new issue