feat: add GitLab CI pipeline for multi-service Docker build

Build all 5 iloom services (gateway, auth, purchaser, textile, washing)
as Docker images and push to Harbor registry.
- main branch: tagged as main-<sha>
- git tag v*: tagged with version number

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Chever John 2026-06-17 10:01:47 +08:00
parent 9c39c8cbd7
commit 7226dfd394
No known key found for this signature in database
GPG Key ID: 2894D52ED1211DF0

57
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,57 @@
stages:
- build
variables:
HARBOR_REGISTRY: harbor-in-k3s.cheverjohn.me
HARBOR_PROJECT: iloom
DOCKER_TLS_CERTDIR: "/certs"
.build-template: &build-template
stage: build
image: docker:27
services:
- docker:27-dind
before_script:
- 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 -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-gateway:
<<: *build-template
variables:
IMAGE_NAME: iloom-gateway
DOCKERFILE_PATH: gateway/Dockerfile
build-auth-service:
<<: *build-template
variables:
IMAGE_NAME: iloom-auth-service
DOCKERFILE_PATH: auth-service/Dockerfile
build-purchaser-service:
<<: *build-template
variables:
IMAGE_NAME: iloom-purchaser-service
DOCKERFILE_PATH: purchaser-service/Dockerfile
build-textile-service:
<<: *build-template
variables:
IMAGE_NAME: iloom-textile-service
DOCKERFILE_PATH: textile-service/Dockerfile
build-washing-service:
<<: *build-template
variables:
IMAGE_NAME: iloom-washing-service
DOCKERFILE_PATH: washing-service/Dockerfile