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

Pipeline Structure

Three build stages were added:

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

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:

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.

← Back to all skills