Gitlab Container Registry Deployment for M324
Overview
Created a multi-stage GitLab CI pipeline to automatically build and publish Docker images for three services used in the M324 project: the .NET backend, the Java backend, and the Ticket System service. This work removed the need for manual local builds and enabled faster, more consistent deployments.
Objectives
- Build Docker images for multiple services using GitLab CI
- Produce multi-architecture images (amd64 + arm64) using Docker buildx
- Tag images with a semantic version and with latest
- Push all generated images to the GitLab Container Registry
- Enable teams to pull and run prebuilt images directly without rebuilding
Pipeline Structure
Three build stages were added:
build_dotnetbuild_javabuild_ticketsystem
Each stage uses the Docker-in-Docker service and buildx to produce multi-arch images.
Example: build_ticketsystem stage
build_ticketsystem:
stage: build
image: docker:24.0
services:
- docker:dind
variables:
DOCKER_HOST: "tcp://docker:2375"
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$DOCKER_REGISTRY"
- docker buildx create --use
- >
docker buildx build --platform linux/amd64,linux/arm64 \
-t "$DOCKER_REGISTRY/$DOCKER_REPOSITORY/ticketsystem:$SEMANTIC_VERSION" \
-t "$DOCKER_REGISTRY/$DOCKER_REPOSITORY/ticketsystem:latest" \
Code/ticketsystem --push
The Java and .NET stages use the same pattern, building from their respective directories.
Benefits
- No more manual local builds — images are always available prebuilt
- Multi-arch support ensures compatibility with x86 servers and ARM devices
- Consistent versioning through semantic version + latest
- Faster deployment since servers can pull prebuilt images immediately
Using the GitLab Container Registry
Login
docker login registry.gitlab.com
Use your GitLab username + Personal Access Token.
Pull an Image
Example for the .NET image:
docker pull registry.gitlab.com/tbz_git_projects/m324-devops-prozesse-mit-tools-unterstuetzen/m324-devops-g2/dotnet
Images can then be:
- Run locally using
docker run - Referenced directly in
docker-compose.ymlfiles
Summary
This pipeline adds automated multi-architecture builds, semantic versioning, and registry publishing for all core services in the M324 project — enabling faster deployments, cleaner workflows, and consistent environments across the team.