From 1f839f650695a00ab079f19703373f6a331e2173 Mon Sep 17 00:00:00 2001
From: Markus Ostermayer <markus.ostermayer@student.tugraz.at>
Date: Sat, 8 Oct 2022 00:47:40 +0200
Subject: [PATCH] Added SWET to the container and switched to kaniko

---
 .gitlab-ci.yml | 18 +++++++++---------
 Dockerfile     |  6 +++++-
 2 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 5e281a9..985f17e 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,16 +1,16 @@
-image: docker:20.10.10
+stages:
+  - build
 
 build-image:
   stage: build
-  variables:
-    IMAGE_NAME: "os-sweb-image"
-    IMAGE_TAG: $CI_REGISTRY_IMAGE/$IMAGE_NAME:latest
-  services:
-    - docker:20.10.10-dind
+  image:
+      name: gcr.io/kaniko-project/executor:v1.9.0-debug
   script:
-    - docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-    - docker build -t $IMAGE_TAG .
-    - docker push $IMAGE_TAG
+    - /kaniko/executor
+      --context "${CI_PROJECT_DIR}"
+      --dockerfile "Dockerfile"
+      --destination "${CI_REGISTRY_IMAGE}:latest"
+      --build-arg CI_TOKEN=${CI_JOB_TOKEN}
   rules:
     - if: $CI_COMMIT_BRANCH == "main"
       changes:
diff --git a/Dockerfile b/Dockerfile
index 0c01d00..e4f0821 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,7 @@
 FROM alpine:3.16
 
+ARG CI_TOKEN
+
 RUN apk update
 # QEMU-Dependencies
 RUN apk update && apk add qemu qemu-img qemu-system-x86_64 \
@@ -8,6 +10,8 @@ RUN apk update && apk add qemu qemu-img qemu-system-x86_64 \
     # https://packages.ubuntu.com/jammy/build-essential
     gcc g++ make libc-dev \
     # Install other sweb Dependencies
-    python3 cmake
+    python3 py3-pip cmake
+
+RUN pip install swet --extra-index-url https://gitlab-ci-token:$CI_TOKEN@gitlab.tugraz.at/api/v4/projects/21215/packages/pypi/simple
 
 WORKDIR /sweb
-- 
GitLab