muyu-apiserver/.gitlab-ci.yml
Chever John ec8ae6a73b fix(ci): use host networking and custom DNS for DinD builds
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-17 10:28:18 +08:00

55 lines
1.5 KiB
YAML

stages:
- build-1
- build-2
variables:
HARBOR_REGISTRY: harbor-in-k3s.cheverjohn.me
HARBOR_PROJECT: iloom
DOCKER_TLS_CERTDIR: "/certs"
DOCKER_HOST: tcp://localhost:2376
DOCKER_TLS_VERIFY: "1"
DOCKER_CERT_PATH: /certs/client
.build-template: &build-template
image: docker:27
services:
- name: docker:27-dind
command: ["--dns", "10.43.0.10", "--dns", "223.5.5.5"]
retry: 2
before_script:
- until docker info >/dev/null 2>&1; do echo "Waiting for Docker daemon..."; sleep 2; done
- echo "$HARBOR_PASSWORD" | docker login $HARBOR_REGISTRY -u "$HARBOR_USER" --password-stdin
script:
- |
if [ -n "$CI_COMMIT_TAG" ]; then
TAG="$CI_COMMIT_TAG"
else
TAG="main-${CI_COMMIT_SHORT_SHA}"
fi
- docker build --network host -t $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$TAG -f $DOCKERFILE_PATH .
- docker push $HARBOR_REGISTRY/$HARBOR_PROJECT/$IMAGE_NAME:$TAG
rules:
- if: $CI_COMMIT_BRANCH == "main"
- if: $CI_COMMIT_TAG =~ /^v/
build-muyu-gateway:
<<: *build-template
stage: build-1
variables:
IMAGE_NAME: muyu-gateway
DOCKERFILE_PATH: deploy/Dockerfile.gateway
build-muyu-system-rpc:
<<: *build-template
stage: build-1
variables:
IMAGE_NAME: muyu-system-rpc
DOCKERFILE_PATH: deploy/Dockerfile.system
build-muyu-inventory-rpc:
<<: *build-template
stage: build-2
variables:
IMAGE_NAME: muyu-inventory-rpc
DOCKERFILE_PATH: deploy/Dockerfile.inventory