Skip to content

Commit

Permalink
SDKTECHNO-273: Add lite version of Python technology
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikail Congar committed Nov 8, 2024
1 parent 2cf8769 commit 84e01b1
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 0 deletions.
21 changes: 21 additions & 0 deletions technologies/job/python/python-3.12-lite/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
FROM python:3.12.4-slim-bullseye

ENV DEBIAN_FRONTEND noninteractive
ENV LC_ALL en_US.UTF-8
ENV LANG en_US.UTF-8

# INSTALL DEPENDENCIES
RUN apt-get update -qq && \
apt-get install -yqq --no-install-recommends unzip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# UPGRADE PIP
RUN pip --no-cache-dir install --upgrade pip

COPY entrypoint /entrypoint
RUN chmod 755 /entrypoint

WORKDIR /sandbox

ENTRYPOINT ["bash","/entrypoint"]
22 changes: 22 additions & 0 deletions technologies/job/python/python-3.12-lite/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright 2019-2021.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import com.bmuschko.gradle.docker.DockerRemoteApiPlugin
import com.saagie.technologies.SaagieTechnologiesGradlePlugin

apply<DockerRemoteApiPlugin>()
apply<SaagieTechnologiesGradlePlugin>()
23 changes: 23 additions & 0 deletions technologies/job/python/python-3.12-lite/context.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
id: "3.12-lite"
label: "3.12-lite"
available: true
recommended: false
trustLevel: stable
job:
features:
- type: COMMAND_LINE
label: Command line
mandatory: true
comment: Linux shell command to launch the job.
defaultValue: python {file} arg1 arg2
- type: ARTIFACT
label: Package
mandatory: false
comment: "Compatible upload file : .py or .zip"
- type: SCHEDULER
label: Scheduled
mandatory: true
- type: AI_DESCRIPTION_GENERATOR
label: AI description generator enabled.
mandatory: true
comment: Activation of the AI-based automatic description generation function.
4 changes: 4 additions & 0 deletions technologies/job/python/python-3.12-lite/dockerInfo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
image: saagie/python
baseTag: 3.12-lite
dynamicVersion: 1.193.0_SDKTECHNO-273
version: 3.12-lite-1.193.0_SDKTECHNO-273
12 changes: 12 additions & 0 deletions technologies/job/python/python-3.12-lite/entrypoint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash
set -euo pipefail

if compgen -G "*.zip*" > /dev/null; then
unzip -q *.zip
fi

if test -f main_script; then
sh ./main_script;
else
exec "$@"
fi
44 changes: 44 additions & 0 deletions technologies/job/python/python-3.12-lite/image_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
schemaVersion: "2.0.0"

metadataTest:
env:
- key: LANG
value: "en_US.UTF-8"
- key: LC_ALL
value: "en_US.UTF-8"

fileExistenceTests:
- name: "unzip"
path: "/usr/bin/unzip"
shouldExist: true
permissions: "-rwxr-xr-x"

- name: "entrypoint"
path: "/entrypoint"
shouldExist: true
permissions: "-rwxr-xr-x"

fileContentTests:
- name: "entrypoint"
path: "/entrypoint"
expectedContents:
[
"unzip -q \\*.zip",
"sh ./main_script",
]

commandTests:
- name: "unzip"
args: ["--help"]
command: "unzip"
exitCode: 0

- name: "python installation"
command: "which"
args: ["python"]
expectedOutput: ["/usr/local/bin/python"]

- name: "python version"
command: "python"
args: ["-V"]
expectedOutput: ["Python 3.12*"]

0 comments on commit 84e01b1

Please sign in to comment.