From 85457a2fe99388160cd222d1c7f7a23d2a5ccd2e Mon Sep 17 00:00:00 2001 From: Alex ubuntu vm <alexdecb@yahoo.es> Date: Thu, 25 Jan 2024 14:34:01 +0100 Subject: [PATCH] l2sm-operator: cleaned python image Following the python guidelines of usage, the operator's Dockerfile has been updated, to use a requirements.txt outside the dockerfile. Identation fixes --- build/build_images.sh | 1 + build/operator/Dockerfile | 12 +++++++++--- src/operator/requirements.txt | 5 +++++ 3 files changed, 15 insertions(+), 3 deletions(-) create mode 100644 src/operator/requirements.txt diff --git a/build/build_images.sh b/build/build_images.sh index e37ce89..6ae0244 100755 --- a/build/build_images.sh +++ b/build/build_images.sh @@ -1,4 +1,5 @@ #!/bin/bash +set -e # Set environment variables export VERSION="2.2" diff --git a/build/operator/Dockerfile b/build/operator/Dockerfile index 47f6bff..abee9f1 100644 --- a/build/operator/Dockerfile +++ b/build/operator/Dockerfile @@ -1,4 +1,10 @@ FROM python:3.11.6 -RUN pip install kopf kubernetes PyMySQL cryptography requests -COPY ./src/operator/l2sm-operator.py /l2sm-operator.py -CMD kopf run --standalone --all-namespaces /l2sm-operator.py + +WORKDIR /usr/src/app + +COPY ./src/operator/requirements.txt ./ +RUN pip install --no-cache-dir -r requirements.txt + +COPY ./src/operator/l2sm-operator.py . + +CMD kopf run --liveness=http://0.0.0.0:8080/healthz --standalone --all-namespaces ./l2sm-operator.py diff --git a/src/operator/requirements.txt b/src/operator/requirements.txt new file mode 100644 index 0000000..a0fc253 --- /dev/null +++ b/src/operator/requirements.txt @@ -0,0 +1,5 @@ +kopf==1.37.0 +kubernetes==28.1.0 +PyMySQL==1.1.0 +cryptography==3.4.8 +requests==2.25.1 \ No newline at end of file -- GitLab