From c728412a3fe3a00cfb38db006c138e92b911c856 Mon Sep 17 00:00:00 2001 From: Passthem Date: Tue, 10 Jun 2025 04:04:29 +0900 Subject: [PATCH] =?UTF-8?q?=E5=A5=BD=E5=93=A6=E6=98=AF=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .drone.yml | 35 +++++++++++++++++++++++++++++++---- hello.txt | 4 ++++ 2 files changed, 35 insertions(+), 4 deletions(-) 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 并运行了这个镜像!请根据内部文档继续操作吧! + +(如果没有文档说明我还没写)