42 lines
1.5 KiB
YAML
42 lines
1.5 KiB
YAML
kind: pipeline
|
|
type: docker
|
|
name: 构建 Goose
|
|
|
|
steps:
|
|
- name: 构建 Goose 二进制包
|
|
image: golang:latest
|
|
environment:
|
|
USERNAME:
|
|
from_secret: USERNAME
|
|
PASSWORD:
|
|
from_secret: API_KEY
|
|
commands:
|
|
- git clone https://github.com/pressly/goose.git
|
|
- cd goose
|
|
- go build -tags='no_mysql no_ydb no_vertica no_mssql no_libsql no_sqlite3 no_clickhouse' -o goose ./cmd/goose
|
|
- mv goose ../goose
|
|
- cd ..
|
|
- curl --user $USERNAME:$PASSWORD --upload-file ./goose https://gitea.service.jazzwhom.top/api/packages/kagami-public/generic/goose/$DRONE_BUILD_NUMBER/goose
|
|
|
|
- name: 构建 Goose Docker 包
|
|
image: docker:latest
|
|
privileged: true
|
|
environment:
|
|
USERNAME:
|
|
from_secret: USERNAME
|
|
PASSWORD:
|
|
from_secret: API_KEY
|
|
DOCKER_REGISTRY: gitea.service.jazzwhom.top
|
|
DOCKER_ORGANIZATION: kagami-public
|
|
DOCKER_APPLICATION: goose
|
|
commands:
|
|
- echo "$PASSWORD" | docker login -u "$USERNAME" --password-stdin "$DOCKER_REGISTRY"
|
|
# 定义镜像名称和标签
|
|
- IMAGE_NAME=${DOCKER_REGISTRY}/${DOCKER_ORGANIZATION}/${DOCKER_APPLICATION}:${DRONE_BUILD_NUMBER}
|
|
- IMAGE_NAME_LATEST=${DOCKER_REGISTRY}/${DOCKER_ORGANIZATION}/${DOCKER_APPLICATION}:latest
|
|
# 构建 Docker 镜像
|
|
- docker build -t ${IMAGE_NAME} .
|
|
- docker tag ${IMAGE_NAME} ${IMAGE_NAME_LATEST} # 同时打上 latest 标签
|
|
# 推送 Docker 镜像
|
|
- docker push ${IMAGE_NAME}
|
|
- docker push ${IMAGE_NAME_LATEST} |