diff --git a/.drone.yml b/.drone.yml index 233d0d8..d28926f 100644 --- a/.drone.yml +++ b/.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 \ No newline at end of file diff --git a/hello.txt b/hello.txt index 90d784e..a50c44c 100644 --- a/hello.txt +++ b/hello.txt @@ -1 +1,5 @@ 喵——帕 + +20250610 追加:恭喜你成功安装了 Docker 并运行了这个镜像!请根据内部文档继续操作吧! + +(如果没有文档说明我还没写)