From c112b4e48e8b1153926b7dead4fa520b85e76269 Mon Sep 17 00:00:00 2001 From: Sangriot <49085035+gitsang@users.noreply.github.com> Date: Thu, 23 May 2024 01:33:55 +0000 Subject: [PATCH] ci: support multi platform --- .github/workflows/{ci.yml => docker.yml} | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) rename .github/workflows/{ci.yml => docker.yml} (74%) diff --git a/.github/workflows/ci.yml b/.github/workflows/docker.yml similarity index 74% rename from .github/workflows/ci.yml rename to .github/workflows/docker.yml index 809400f..9915675 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/docker.yml @@ -1,4 +1,4 @@ -name: ci +name: docker on: create: @@ -32,15 +32,13 @@ jobs: VERSION=${{ steps.get_version.outputs.VERSION }} mkdir -p ${TARGET_PATH} ${TARGET_PATH}/bin ${TARGET_PATH}/conf ${TARGET_PATH}/log - go build \ + CGO_ENABLED=0 go build \ -ldflags "-X ddns/pkg/config.Version=${VERSION}" \ -o ${TARGET_PATH}/bin/${SERVICE_NAME} cmd/${SERVICE_NAME}.go cp configs/template.yml ${TARGET_PATH}/conf - docker build -f Dockerfile --no-cache \ + docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v6/linux/arm/v7,linux/arm/v8 \ + -f Dockerfile --no-cache \ --build-arg DOCKER_PACKAGE_PATH=${TARGET_PATH} \ - -t ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} . - docker tag ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} ${DOCKER_REPO}/${SERVICE_NAME}:latest - - docker push ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} - docker push ${DOCKER_REPO}/${SERVICE_NAME}:latest + -t ${DOCKER_REPO}/${SERVICE_NAME}:${VERSION} \ + --push . \ No newline at end of file