Some checks reported errors
continuous-integration/drone/push Build encountered an error
37 lines
1.0 KiB
YAML
37 lines
1.0 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: default
|
|
|
|
steps:
|
|
- 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 "$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 |