docker-with-buildx/.drone.yml

40 lines
1010 B
YAML

kind: pipeline
type: docker
name: docker-with-buildx
steps:
- name: docker build an publish
image: docker:20.10.22-dind-alpine3.17
environment:
DOCKER_REGISTRY_TOKEN:
from_secret: DOCKER_REGISTRY_TOKEN
DOCKER_IMAGE_NAME:
from_secret: DOCKER_IMAGE_NAME
DOCKER_REGISTRY_USER:
from_secret: DOCKER_REGISTRY_USER
volumes:
- name: dockersock
path: /var/run
commands:
- sleep 15
- echo "$DOCKER_REGISTRY_TOKEN" | docker login docker.io --username $DOCKER_REGISTRY_USER --password-stdin
- docker build --no-cache -t "$DOCKER_IMAGE_NAME:latest" -t "$DOCKER_IMAGE_NAME:$DRONE_TAG" .
- docker push "$DOCKER_IMAGE_NAME:latest"
- docker push "$DOCKER_IMAGE_NAME:$DRONE_TAG"
trigger:
ref:
- refs/tags/v.*.*.*
services:
- name: docker
image: docker:20.10.22-dind-alpine3.17
privileged: true
volumes:
- name: dockersock
path: /var/run
volumes:
- name: dockersock
temp: {}