From 2abcd41725c5762f4acd565b639d150649981f19 Mon Sep 17 00:00:00 2001
From: Matthew Defenderfer <mdefende@uab.edu>
Date: Wed, 10 Jul 2024 12:21:19 -0500
Subject: [PATCH] add gitlab ci yml

---
 .gitlab-ci.yml | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
 create mode 100644 .gitlab-ci.yml

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644
index 0000000..2a325d5
--- /dev/null
+++ b/.gitlab-ci.yml
@@ -0,0 +1,30 @@
+docker-build:
+  # Use the official docker image.
+  image: docker:stable
+  stage: build
+  services:
+    - docker:26.0.1-dind
+  variables:
+    DOCKER_IMAGE_NAME: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
+    DOCKER_TLS_CERTDIR: "/certs"
+  before_script:
+    - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY
+  cache:
+    key: ${CI_COMMIT_REF_SLUG}
+    paths:
+      - cache/
+  # All branches are tagged with $DOCKER_IMAGE_NAME (defaults to commit ref slug)
+  # Default branch is also tagged with `latest`
+  script:
+    - docker build --cache-from ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_SLUG} --pull -t "$DOCKER_IMAGE_NAME" .
+    - docker push "$DOCKER_IMAGE_NAME"
+    - |
+      if [[ "$CI_COMMIT_BRANCH" == "$CI_DEFAULT_BRANCH" ]]; then
+        docker tag "$DOCKER_IMAGE_NAME" "$CI_REGISTRY_IMAGE:latest"
+        docker push "$CI_REGISTRY_IMAGE:latest"
+      fi
+  # Run this job in a branch where a Dockerfile exists
+  rules:
+    - if: $CI_COMMIT_BRANCH
+      exists:
+        - Dockerfile
\ No newline at end of file
-- 
GitLab