This commit is contained in:
35
.drone.yml
35
.drone.yml
@ -3,8 +3,35 @@ type: docker
|
||||
name: default
|
||||
|
||||
steps:
|
||||
- name: greeting
|
||||
image: alpine
|
||||
- name: 打包 Docker 容器
|
||||
image: docker:latest
|
||||
privileged: true
|
||||
environment:
|
||||
DOCKER_TAG: ${DRONE_COMMIT_SHA:0:8}
|
||||
DOCKER_USERNAME:
|
||||
from_secret: DOCKER_USERNAME
|
||||
DOCKER_PASSWORD:
|
||||
from_secret: DOCKER_PASSWORD
|
||||
DOCKER_REGISTRY: gitea.service.jazzwhom.top
|
||||
|
||||
commands:
|
||||
- echo hello
|
||||
- echo world
|
||||
- echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin "$DOCKER_REGISTRY"
|
||||
- docker build -t "$DOCKER_REGISTRY/your-org/your-app:$DOCKER_TAG" .
|
||||
- docker build -t "$DOCKER_REGISTRY/your-org/your-app:latest" .
|
||||
- docker push "$DOCKER_REGISTRY/your-org/your-app:$DOCKER_TAG"
|
||||
- docker push "$DOCKER_REGISTRY/your-org/your-app:latest"
|
||||
|
||||
- name: 清理累赘的 Docker 镜像
|
||||
image: docker:latest
|
||||
privileged: true
|
||||
commands:
|
||||
- docker rmi "$DOCKER_REGISTRY/your-org/your-app:$DOCKER_TAG"
|
||||
- docker rmi "$DOCKER_REGISTRY/your-org/your-app:latest"
|
||||
when:
|
||||
status:
|
||||
- success
|
||||
- failure
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- push
|
||||
Reference in New Issue
Block a user