From 58d6b12a67f504101d09f78105d86ff8624c1015 Mon Sep 17 00:00:00 2001 From: Sheldan <5037282+Sheldan@users.noreply.github.com> Date: Wed, 20 Dec 2023 21:07:59 +0100 Subject: [PATCH] [SIS-xxx] refactoring to use a base image for rest api instead of a zipfile changing image pull policy for rest api and bot to always renaming rest api container --- Tiltfile | 3 ++- .../sissi/templates/rest-api-deployment.yaml | 2 +- deployment/helm/sissi/values.yaml | 4 ++-- deployment/image-packaging/pom.xml | 19 ------------------- .../image-packaging/src/main/docker/.env | 3 ++- .../src/main/docker/rest-api/Dockerfile | 14 +++++--------- .../src/main/docker/rest-api/requirements.txt | 17 ----------------- 7 files changed, 12 insertions(+), 50 deletions(-) delete mode 100644 deployment/image-packaging/src/main/docker/rest-api/requirements.txt diff --git a/Tiltfile b/Tiltfile index b014b984..abec49ad 100644 --- a/Tiltfile +++ b/Tiltfile @@ -2,6 +2,7 @@ allow_k8s_contexts('k8s-cluster') load('ext://restart_process', 'docker_build_with_restart') registry = 'harbor.sheldan.dev/sissi/' +abstracto_registry = 'harbor.sheldan.dev/abstracto/' local_resource( 'sissi-java-compile', @@ -28,7 +29,7 @@ docker_build_with_restart( ) docker_build(registry + 'sissi-db-data', 'deployment/image-packaging/src/main/docker/db-data/') -docker_build(registry + 'sissi-rest-api', 'deployment/image-packaging/src/main/docker/rest-api/') +docker_build(registry + 'sissi-rest-api', 'deployment/image-packaging/src/main/docker/rest-api/', build_args={'REGISTRY_PREFIX': abstracto_registry}) docker_build(registry + 'sissi-template-data', 'deployment/image-packaging/src/main/docker/template-data/') diff --git a/deployment/helm/sissi/templates/rest-api-deployment.yaml b/deployment/helm/sissi/templates/rest-api-deployment.yaml index 90820316..89187f39 100644 --- a/deployment/helm/sissi/templates/rest-api-deployment.yaml +++ b/deployment/helm/sissi/templates/rest-api-deployment.yaml @@ -25,7 +25,7 @@ spec: securityContext: {{- toYaml .Values.restApi.podSecurityContext | nindent 8 }} containers: - - name: {{ .Chart.Name }} + - name: {{ .Chart.Name }}-rest-api securityContext: {{- toYaml .Values.restApi.securityContext | nindent 12 }} image: "{{ .Values.restApi.repository }}/{{ .Values.restApi.image }}:{{ .Values.restApi.tag | default .Chart.AppVersion }}" diff --git a/deployment/helm/sissi/values.yaml b/deployment/helm/sissi/values.yaml index 0fee8976..ce431015 100644 --- a/deployment/helm/sissi/values.yaml +++ b/deployment/helm/sissi/values.yaml @@ -6,7 +6,7 @@ replicaCount: 1 bot: repository: harbor.sheldan.dev/sissi - pullPolicy: IfNotPresent + pullPolicy: Always image: sissi-bot tag: 1.4.29 livenessProbe: @@ -23,7 +23,7 @@ bot: restApi: enabled: true repository: harbor.sheldan.dev/sissi - pullPolicy: IfNotPresent + pullPolicy: Always image: sissi-rest-api tag: 1.4.29 podAnnotations: {} diff --git a/deployment/image-packaging/pom.xml b/deployment/image-packaging/pom.xml index 1c1fd2e5..91e6fe7d 100644 --- a/deployment/image-packaging/pom.xml +++ b/deployment/image-packaging/pom.xml @@ -826,25 +826,6 @@ - - unpack - process-resources - - unpack - - - - - dev.sheldan.sissi.api - rest-api - ${abstracto.version} - zip - true - ${file.basedir}/rest-api/python - - - - diff --git a/deployment/image-packaging/src/main/docker/.env b/deployment/image-packaging/src/main/docker/.env index e8a4f8df..a28b2357 100644 --- a/deployment/image-packaging/src/main/docker/.env +++ b/deployment/image-packaging/src/main/docker/.env @@ -1,2 +1,3 @@ REGISTRY_PREFIX=harbor.sheldan.dev/sissi/ -VERSION=1.4.29 \ No newline at end of file +VERSION=1.4.29 +ABSTRACTO_VERSION=1.5.15 \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/rest-api/Dockerfile b/deployment/image-packaging/src/main/docker/rest-api/Dockerfile index f3fd94a5..9bab4018 100644 --- a/deployment/image-packaging/src/main/docker/rest-api/Dockerfile +++ b/deployment/image-packaging/src/main/docker/rest-api/Dockerfile @@ -1,9 +1,5 @@ -FROM python:3.10.13-alpine3.18 -ADD requirements.txt / -RUN pip install -r requirements.txt -RUN apk --no-cache add msttcorefonts-installer fontconfig && \ - update-ms-fonts && \ - fc-cache -f -ADD wrapper / -ADD python /python -CMD ["/run.sh"] \ No newline at end of file +ARG REGISTRY_PREFIX + +FROM ${REGISTRY_PREFIX}abstracto-rest-api:${ABSTRACTO_VERSION:-latest} +ADD python/resources /python/resources +ADD python/custom /python/custom \ No newline at end of file diff --git a/deployment/image-packaging/src/main/docker/rest-api/requirements.txt b/deployment/image-packaging/src/main/docker/rest-api/requirements.txt deleted file mode 100644 index 3d3e1406..00000000 --- a/deployment/image-packaging/src/main/docker/rest-api/requirements.txt +++ /dev/null @@ -1,17 +0,0 @@ -blinker==1.7.0 -certifi==2023.7.22 -charset-normalizer==3.3.2 -click==8.1.7 -Flask==3.0.0 -idna==3.4 -importlib-metadata==6.8.0 -itsdangerous==2.1.2 -Jinja2==3.1.2 -MarkupSafe==2.1.3 -Pillow==10.1.0 -requests==2.31.0 -urllib3==2.0.7 -waitress==2.1.2 -Werkzeug==3.0.1 -zipp==3.17.0 -pytz==2023.3.post1 \ No newline at end of file