Compare commits

...

1 commit

Author SHA1 Message Date
3dcd218801
refactor: use plugins/docker instead of manual dind setup
Some checks failed
continuous-integration/drone/push Build is failing
2025-10-30 19:20:38 +01:00

View file

@ -2,13 +2,6 @@ kind: pipeline
type: docker type: docker
name: build-and-publish name: build-and-publish
services:
- name: docker
image: docker:dind
privileged: true
environment:
DOCKER_TLS_CERTDIR: "" # Disable TLS and Unix socket - use TCP only
trigger: trigger:
branch: branch:
- main - main
@ -19,43 +12,35 @@ trigger:
steps: steps:
- name: build-and-publish-container - name: build-and-publish-container
image: docker:cli image: plugins/docker
environment: settings:
DOCKER_HOST: tcp://docker:2375 # Connect to dind service registry: git.local-it.org
REGISTRY: git.local-it.org/ci-builder repo: git.local-it.org/ci-builder/mitgliederverwaltung
IMAGE_NAME: mitgliederverwaltung username:
REGISTRY_USERNAME:
from_secret: DRONE_REGISTRY_USERNAME from_secret: DRONE_REGISTRY_USERNAME
REGISTRY_TOKEN: password:
from_secret: DRONE_REGISTRY_TOKEN from_secret: DRONE_REGISTRY_TOKEN
commands: auto_tag: true
- sleep 5 # give docker time to start auto_tag_suffix: ${DRONE_COMMIT_SHA:0:8}
- docker info # verify docker is ready when:
# Build image once event:
- docker build --tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER . - tag
# Login to registry
- echo "$REGISTRY_TOKEN" | docker login --username "$REGISTRY_USERNAME" --password-stdin git.local-it.org - name: build-and-publish-container-branch
# Tag and push based on event type image: plugins/docker
- | settings:
if [ "$DRONE_BUILD_EVENT" = "tag" ]; then registry: git.local-it.org
# For tag events: use tag version (e.g., v1.0.0 -> 1.0.0) and latest repo: git.local-it.org/ci-builder/mitgliederverwaltung
VERSION=$(echo $DRONE_TAG | sed 's/^v//') username:
echo "Tagging and pushing version $VERSION" from_secret: DRONE_REGISTRY_USERNAME
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:$VERSION password:
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:latest from_secret: DRONE_REGISTRY_TOKEN
docker push $REGISTRY/$IMAGE_NAME:$VERSION tags:
docker push $REGISTRY/$IMAGE_NAME:latest - latest
else - ${DRONE_COMMIT_SHA:0:8}
# For main branch pushes: use commit SHA and latest when:
echo "Tagging and pushing commit $DRONE_COMMIT_SHA" event:
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:$DRONE_COMMIT_SHA - push
docker tag $REGISTRY/$IMAGE_NAME:build-$DRONE_BUILD_NUMBER $REGISTRY/$IMAGE_NAME:latest
docker push $REGISTRY/$IMAGE_NAME:$DRONE_COMMIT_SHA
docker push $REGISTRY/$IMAGE_NAME:latest
fi
# No volumes needed - docker:cli connects to dind service via TCP
--- ---
kind: pipeline kind: pipeline