From 704369eec0941d4d201822aa9d7f185c68df104f Mon Sep 17 00:00:00 2001
From: Yasin Ali Marouga <yasinam@stud.ntnu.no>
Date: Fri, 3 May 2024 15:35:13 +0200
Subject: [PATCH] chore: implement deployment to docker hub

---
 .gitlab-ci.yml | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1003295..b8c4086 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -6,6 +6,7 @@ stages:
   - build
   - test
   - security_scan
+  - deploy
 
 cache:
   key: ${CI_COMMIT_REF_SLUG}
@@ -62,4 +63,21 @@ include:
 sast:
   stage: security_scan
   script:
-    - echo "Running SAST..."
\ No newline at end of file
+    - echo "Running SAST..."
+
+deploy:
+  stage: deploy
+  image: docker:latest
+  tags:
+    - dind
+  services:
+    - name: docker:dind
+  variables:
+    DOCKER_DRIVER: overlay2
+    DOCKER_IMAGE_NAME: $CI_REGISTRY_USER/idatt2106_2024_02_frontend-app
+    DOCKER_TLS_CERTDIR: ""
+    DOCKER_HOST: tcp://docker:2375
+  script:
+    - echo "$CI_REGISTRY_PASSWORD" | docker login --username $CI_REGISTRY_USER --password-stdin
+    - docker build -t $DOCKER_IMAGE_NAME:latest .
+    - docker push $DOCKER_IMAGE_NAME:latest
-- 
GitLab