66 lines
2.0 KiB
YAML
66 lines
2.0 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
volumes:
|
|
- name: dockersock
|
|
host:
|
|
path: /var/run/docker.sock
|
|
|
|
steps:
|
|
- name: docker-build
|
|
image: docker:24
|
|
volumes:
|
|
- name: dockersock
|
|
path: /var/run/docker.sock
|
|
environment:
|
|
GITEA_USERNAME:
|
|
from_secret: gitea_username
|
|
GITEA_TOKEN:
|
|
from_secret: gitea_token
|
|
commands:
|
|
- export DOCKER_BUILDKIT=1
|
|
- docker buildx create --use --driver docker-container || true
|
|
- echo "$GITEA_TOKEN" | docker login 192.168.1.9:3000 -u "$GITEA_USERNAME" --password-stdin
|
|
- docker buildx build \
|
|
--builder default \
|
|
--tag 192.168.1.9:3000/tai/aberwyn/aberwyn:latest \
|
|
--tag 192.168.1.9:3000/tai/aberwyn/aberwyn:${DRONE_COMMIT_SHA:0:7} \
|
|
--cache-from=type=registry,ref=192.168.1.9:3000/tai/aberwyn/aberwyn:buildcache \
|
|
--cache-to=type=registry,ref=192.168.1.9:3000/tai/aberwyn/aberwyn:buildcache,mode=max \
|
|
--push \
|
|
--allow insecure \
|
|
-f Aberwyn/Dockerfile .
|
|
|
|
|
|
- name: restart-unraid-container
|
|
image: appleboy/drone-ssh
|
|
settings:
|
|
host: 192.168.1.108
|
|
port: 22
|
|
username:
|
|
from_secret: unraid_ssh_user
|
|
key:
|
|
from_secret: unraid_ssh_private_key
|
|
script:
|
|
- docker pull 192.168.1.9:3000/tai/aberwyn/aberwyn:latest
|
|
- docker stop aberwyn || true
|
|
- docker rm aberwyn || true
|
|
- docker volume create aberwyn_config || true
|
|
- docker run -d --name=aberwyn --net=br0 -e TZ=Europe/Berlin -p 80:80 -v aberwyn_config:/app/infrastructure 192.168.1.9:3000/tai/aberwyn/aberwyn:latest
|
|
|
|
- name: notify-result
|
|
image: alpine
|
|
when:
|
|
status:
|
|
- success
|
|
- failure
|
|
commands:
|
|
- apk add --no-cache curl
|
|
- |
|
|
if [ "$DRONE_BUILD_STATUS" = "success" ]; then
|
|
curl -X POST http://192.168.1.196:8123/api/webhook/aberwyn_update_success
|
|
else
|
|
curl -X POST http://192.168.1.196:8123/api/webhook/aberwyn_update_failed
|
|
fi
|