Kevin Nowak f0077c88c1
Some checks failed
continuous-integration/drone/push Build is failing
.drone.yml aktualisiert
2026-05-17 10:35:40 +00:00

60 lines
1.6 KiB
YAML

kind: pipeline
type: docker
name: default
steps:
- name: build-image
image: gcr.io/kaniko-project/executor:debug
commands:
- /kaniko/executor
--context=.
--dockerfile=Dockerfile
--destination=test-app:latest
--no-push
--tar-path=image.tar
- name: size-check
image: alpine:latest
commands:
- |
SIZE=$(stat -c%s image.tar)
SIZE_MB=$((SIZE / 1024 / 1024))
echo "Image size: ${SIZE_MB}MB"
if [ "$SIZE_MB" -gt 150 ]; then
echo "Image too large!"
exit 1
fi
- name: security-scan
image: aquasec/trivy:0.69.3
commands:
- trivy image --input image.tar --severity HIGH,CRITICAL --exit-code 1
- name: push-artifact
image: alpine:latest
environment:
GITEA_TOKEN:
from_secret: drone_token
commands:
- apk add --no-cache git
# Git konfigurieren
- git config --global user.email "drone@ci.local"
- git config --global user.name "Drone CI"
# Das fertige Image kurz zwischenspeichern
- cp image.tar /tmp/image.tar
# Informationen holen und in den Branch wechseln
- git fetch origin
- git checkout drone-artifacts || git checkout -b drone-artifacts
# Das Image zurückholen
- cp /tmp/image.tar ./image.tar
# Datei committen
- git add image.tar
- git commit -m "Add built Docker image [skip ci]" || echo "Nothing to commit"
# DER FINALE TRICK: Direkt mit Username + Token an die Ziel-URL pushen
- git push https://$$GITEA_TOKEN@git.efi.th-nuernberg.de/gitea/nowakke92618/EinfuehrungInDocker_Pipeline2.git drone-artifacts