From e97b778cb7c0bb8f4a5af1ef57486697eba2b8c8 Mon Sep 17 00:00:00 2001 From: Phil Skentelbery Date: Sun, 23 Nov 2025 19:59:41 -0700 Subject: [PATCH] ci: Add GitLab CI/CD pipeline for container builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Builds and pushes container images to GitLab Container Registry when version tags (v*.*.*) are pushed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- .gitlab-ci.yml | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .gitlab-ci.yml diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..efb3eb9 --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,40 @@ +# GitLab CI/CD Pipeline for StarPunk +# Builds and pushes container images on version tags + +stages: + - build + +variables: + # Required for Docker-in-Docker + DOCKER_TLS_CERTDIR: "/certs" + # Use overlay2 driver for better performance + DOCKER_DRIVER: overlay2 + +# Build and push container image +build-container: + stage: build + image: docker:24 + services: + - docker:24-dind + # Only trigger on version tags (e.g., v0.9.5, v1.0.0) + rules: + - if: $CI_COMMIT_TAG =~ /^v[0-9]+\.[0-9]+\.[0-9]+$/ + before_script: + # Login to GitLab Container Registry + - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY + script: + # Build the container image with both version and latest tags + - | + docker build \ + --tag $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG \ + --tag $CI_REGISTRY_IMAGE:latest \ + --file Containerfile \ + . + # Push both tags to the registry + - docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG + - docker push $CI_REGISTRY_IMAGE:latest + # Cache Docker layers between builds + cache: + key: docker-$CI_COMMIT_REF_SLUG + paths: + - .docker-cache