Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8-buster
FROM python:3.10-slim-bookworm

RUN apt-get update \
&& apt-get install --no-install-recommends -y \
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/aliyun_fc/aliyun_fc.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def download_requirements():
if docker_path:
# Build the runtime in a docker
cmd = 'python3 -m pip install -U -t . -r requirements.txt'
cmd = f'docker run -w /tmp -v {build_dir}:/tmp python:{utils.CURRENT_PY_VERSION}-slim-buster {cmd}'
cmd = f'docker run -w /tmp -v {build_dir}:/tmp python:{utils.CURRENT_PY_VERSION}-slim-bookworm {cmd}'
utils.run_command(cmd)
else:
logger.warning('Aliyun Functions use a Linux environment. Building'
Expand Down
1 change: 0 additions & 1 deletion lithops/serverless/backends/aliyun_fc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
BUILD_DIR = os.path.join(TEMP_DIR, 'AliyunRuntimeBuild')

AVAILABLE_PY_RUNTIMES = {
'3.6': 'python3',
'3.9': 'python3.9',
'3.10': 'python3.10'
}
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/aws_batch/aws_batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ def _build_default_runtime(self, runtime_name):
python_version = utils.version_str(sys.version_info)
dockerfile = "Dockerfile.default-batch-runtime"
with open(dockerfile, 'w') as f:
f.write(f"FROM python:{python_version}-slim-buster\n")
f.write(f"FROM python:{python_version}-slim-bookworm\n")
f.write(batch_config.DOCKERFILE_DEFAULT)
try:
self.build_runtime(runtime_name, dockerfile)
Expand Down
2 changes: 0 additions & 2 deletions lithops/serverless/backends/aws_lambda/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
]

AVAILABLE_PY_RUNTIMES = {
'3.6': 'python3.6',
'3.7': 'python3.7',
'3.8': 'python3.8',
'3.9': 'python3.9',
'3.10': 'python3.10',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def _build_default_runtime(self, runtime_name):
# Build default runtime using local dokcer
dockerfile = "Dockefile.default-az-runtime"
with open(dockerfile, 'w') as f:
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-buster\n")
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-bookworm\n")
f.write(config.DEFAULT_DOCKERFILE)
try:
self.build_runtime(runtime_name, dockerfile)
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/azure_functions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
'trigger': 'pub/sub'
}

AVAILABLE_PY_RUNTIMES = ['3.7', '3.8', '3.9', '3.10', '3.11']
AVAILABLE_PY_RUNTIMES = ['3.8', '3.9', '3.10', '3.11']

REQUIRED_AZURE_STORAGE_PARAMS = ('storage_account_name', 'storage_account_key')
REQUIRED_AZURE_FUNCTIONS_PARAMS = ('resource_group', 'region')
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/code_engine/code_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def _build_default_runtime(self, default_runtime_img_name):
# Build default runtime using local dokcer
dockerfile = "Dockefile.default-ce-runtime"
python_version = utils.CURRENT_PY_VERSION
base_image = "slim-buster" if int(python_version.split('.')[1]) < 13 else "bookworm"
base_image = "slim-bookworm"
with open(dockerfile, 'w') as f:
f.write(f"FROM python:{python_version}-{base_image}\n")
f.write(config.DOCKERFILE_DEFAULT)
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/gcp_cloudrun/cloudrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ def _build_default_runtime(self, runtime_name):
# Build default runtime using local dokcer
dockerfile = "Dockefile.default-kn-runtime"
with open(dockerfile, 'w') as f:
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-buster\n")
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-bookworm\n")
f.write(config.DEFAULT_DOCKERFILE)
try:
self.build_runtime(runtime_name, dockerfile)
Expand Down
1 change: 0 additions & 1 deletion lithops/serverless/backends/gcp_functions/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
RUNTIME_MEMORY_OPTIONS = {128, 256, 512, 1024, 2048, 4096, 8192}

AVAILABLE_PY_RUNTIMES = {
'3.7': 'python37',
'3.8': 'python38',
'3.9': 'python39',
'3.10': 'python310',
Expand Down
2 changes: 0 additions & 2 deletions lithops/serverless/backends/ibm_cf/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import os

AVAILABLE_PY_RUNTIMES = {
'3.6': 'docker.io/lithopscloud/ibmcf-python-v36',
'3.7': 'docker.io/lithopscloud/ibmcf-python-v37',
'3.8': 'docker.io/lithopscloud/ibmcf-python-v38',
'3.9': 'docker.io/lithopscloud/ibmcf-python-v39',
'3.10': 'docker.io/lithopscloud/ibmcf-python-v310',
Expand Down
4 changes: 2 additions & 2 deletions lithops/serverless/backends/knative/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,9 @@
name: lithops-git
params:
- name: pathToDockerFile
value: lithops/compute/backends/knative/tekton/Dockerfile.python36
value: lithops/compute/backends/knative/tekton/Dockerfile.python38
- name: imageUrl
value: docker.io/jsampe/lithops-knative-v36
value: docker.io/jsampe/lithops-knative-v38
- name: imageTag
value: latest
"""
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/knative/knative.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def _build_default_runtime(self, default_runtime_img_name):
# Build default runtime using local dokcer
dockerfile = "Dockefile.default-kn-runtime"
with open(dockerfile, 'w') as f:
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-buster\n")
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-bookworm\n")
f.write(config.DEFAULT_DOCKERFILE)
try:
self.build_runtime(default_runtime_img_name, dockerfile)
Expand Down
27 changes: 0 additions & 27 deletions lithops/serverless/backends/knative/tekton/Dockerfile.python36

This file was deleted.

27 changes: 0 additions & 27 deletions lithops/serverless/backends/knative/tekton/Dockerfile.python37

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.8.2-slim-buster
FROM python:3.8.2-slim-bookworm

RUN apt-get update && apt-get install -y \
zip \
Expand Down
2 changes: 0 additions & 2 deletions lithops/serverless/backends/openwhisk/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
import os

AVAILABLE_PY_RUNTIMES = {
'3.6': 'docker.io/lithopscloud/openwhisk-python-v36',
'3.7': 'docker.io/lithopscloud/openwhisk-python-v37',
'3.8': 'docker.io/lithopscloud/openwhisk-python-v38',
'3.9': 'docker.io/lithopscloud/openwhisk-python-v39',
'3.10': 'docker.io/lithopscloud/openwhisk-python-v310',
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/oracle_f/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
ENTRYPOINT ["/usr/local/bin/fdk", "handler/entry_point.py", "handler"]
"""

AVAILABLE_PY_RUNTIMES = ['3.6', '3.7', '3.8', '3.9', '3.11']
AVAILABLE_PY_RUNTIMES = ['3.8', '3.9', '3.11']

REQ_PARAMS_1 = ('compartment_id', 'user', 'key_file', 'region', 'tenancy', 'fingerprint')
REQ_PARAMS_2 = ('subnet_id', )
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/oracle_f/oracle_f.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def _build_default_runtime(self, runtime_name):
# Build default runtime using local dokcer
dockerfile = "Dockefile.default-oracle-runtime"
with open(dockerfile, 'w') as f:
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-buster\n")
f.write(f"FROM python:{utils.CURRENT_PY_VERSION}-slim-bookworm\n")
f.write(config.DEFAULT_DOCKERFILE)
try:
self.build_runtime(runtime_name, dockerfile)
Expand Down
2 changes: 1 addition & 1 deletion lithops/serverless/backends/singularity/singularity.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def _create_default_runtime(self):

with open(singularityfile, 'w') as f:
f.write("Bootstrap: docker\n")
f.write(f"From: python:{utils.CURRENT_PY_VERSION}-slim-buster\n")
f.write(f"From: python:{utils.CURRENT_PY_VERSION}-slim-bookworm\n")
f.write(config.SINGULARITYFILE_DEFAULT)

return singularityfile
Expand Down
6 changes: 3 additions & 3 deletions runtime/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Choose your compute backend:
2. [IBM VPC](ibm_vpc/)
3. [AWS Lambda](aws_lambda/)
4. [AWS EC2](aws_ec2/)
2. [Google Cloud Functions](gcp_functions/)
3. [Google Cloud Run](gcp_cloudrun/)
5. [Google Cloud Functions](gcp_functions/)
6. [Google Cloud Run](gcp_cloudrun/)
7. [Azure Functions](azure_functions/)
8. [Azure Container APPs](azure_containers/)
8. [Azure Container Apps](azure_containers/)
9. [Aliyun Functions Compute](aliyun_fc/)
10. [Kubernetes](kubernetes/)
11. [OpenWhisk](openwhisk/)
Expand Down
8 changes: 4 additions & 4 deletions runtime/aliyun_fc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

The runtime is the place where your functions are executed. The default runtime is automatically created the first time you execute a function. Lithops automatically detects the Python version of your environment and deploys the default runtime based on it.

Currently, Aliyun Functions Compute supports Python 3.6, 3.9 and 3.10. You can find the list of pre-installed modules [here](https://www.alibabacloud.com/help/en/function-compute/latest/python-event-functions). In addition, the Lithops default runtimes are built with the packages included in this [requirements.txt](requirements.txt) file:
Currently, Aliyun Functions Compute supports Python 3.9 and 3.10. You can find the list of pre-installed modules [here](https://www.alibabacloud.com/help/en/function-compute/latest/python-event-functions). In addition, the Lithops default runtimes are built with the packages included in this [requirements.txt](requirements.txt) file:

To run a function with the default runtime you don't need to specify anything in the code, since everything is handled internally by Lithops:

Expand Down Expand Up @@ -30,15 +30,15 @@ pw = lithops.FunctionExecutor(runtime_memory=512)

If you require additional Python modules not included in the default runtime, you can create your own custom Lithops runtime incorporating them. To create a custom runtime, compile all the necessary modules into a `requirements.txt` file.

For instance, if you wish to integrate the `matplotlib` module into your runtime, which isn't part of the default setup, you need to append it to the existing [requirements.txt](requirements.txt) file. Note that this `requirements.txt` contains the mandatory pakcges required by lithops, so you don't have to remove any of them from the list, but just add your packages at the end.
For instance, if you wish to integrate the `matplotlib` module into your runtime, which isn't part of the default setup, you need to append it to the existing [requirements.txt](requirements.txt) file. Note that this `requirements.txt` contains the mandatory packages required by lithops, so you don't have to remove any of them from the list, but just add your packages at the end.

After updating the file accordingly, you can proceed to build the custom runtime by specifying the modified `requirements.txt` file along with a chosen runtime name:

```
$ lithops runtime build -b aliyun_fc -f requirements.txt my_matplotlib_runtime
```

This command will built and deploy a runtime called `my_matplotlib_runtime` to the available Aliyun FUnctions Compute runtimes.
This command will build and deploy a runtime called `my_matplotlib_runtime` to the available Aliyun Functions Compute runtimes.

Finally, we can specify this new runtime when creating a Lithops Function Executor:

Expand All @@ -55,4 +55,4 @@ res = lith.get_result()
print(res)
```

Note that both the client and the runtime must have the same python version. If you are running Lithops, for example, with Python 3.8, `my_matplotlib_runtime` will be a Python 3.8 runtime with the extra modules specified installed.
Note that both the client and the runtime must have the same Python version. If you are running Lithops, for example, with Python 3.8, `my_matplotlib_runtime` will be a Python 3.8 runtime with the extra modules specified installed.
12 changes: 4 additions & 8 deletions runtime/aws_batch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Python 3.6
#FROM python:3.6-slim-buster

# Python 3.7
#FROM python:3.7-slim-buster

# Python 3.8
#FROM python:3.8-slim-buster
#FROM python:3.8-slim-bookworm

# Python 3.9
#FROM python:3.9-slim-buster
#FROM python:3.9-slim-bookworm

# Python 3.10
FROM python:3.10-slim-buster
FROM python:3.10-slim-bookworm

RUN apt-get update && apt-get install -y \
zip \
Expand Down Expand Up @@ -40,4 +36,4 @@ WORKDIR $APP_HOME
COPY lithops_aws_batch.zip .
RUN unzip lithops_aws_batch.zip && rm lithops_aws_batch.zip

ENTRYPOINT python entry_point.py
ENTRYPOINT python entry_point.py
8 changes: 0 additions & 8 deletions runtime/aws_batch/conda.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
# Python 3.6
#FROM continuumio/miniconda3:4.5.4

# Python 3.7
#FROM continuumio/miniconda3:4.7.12

# Python 3.8
#FROM continuumio/miniconda3:4.9.2

# Python 3.9
FROM continuumio/miniconda3:4.10.3

# YOU MUST PIN THE PYTHON VERSION TO PREVENT IT TO BE UPDATED
# For python 3.6 use "python==3.6.5"
# For python 3.7 use "python==3.7.4"
# For python 3.8 use "python==3.8.5"
# For python 3.9 use "python==3.9.5"
RUN echo "python==3.9.13" >> /opt/conda/conda-meta/pinned
Expand Down
2 changes: 1 addition & 1 deletion runtime/aws_ec2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ If you want to upload local files to the custom VM Image, you can include them u
lithops image build -b aws_ec2 -f myscript.sh -i /home/user/test.bin:/home/ubuntu/test.bin custom-lithops-runtime
```

In the case of using using a custom name, you must provide the `target_ami`, printed at the end of the build command, in your lithops config, for example:
In the case of using a custom name, you must provide the `target_ami`, printed at the end of the build command, in your lithops config, for example:

```yaml
aws_ec2:
Expand Down
4 changes: 0 additions & 4 deletions runtime/aws_lambda/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
# Python 3.6
#FROM python:3.6-slim-trixie

# Python 3.7
#FROM python:3.7-slim-trixie

# Python 3.8
#FROM python:3.8-slim-trixie
Expand Down
6 changes: 3 additions & 3 deletions runtime/aws_lambda/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ The runtime is the place where your functions are executed.
AWS Lambda provides two methods for packaging the function code and dependencies of a runtime:

## Using predefined **runtimes** and **layers**
An AWS Lambda *runtime* is a predefined environment to run code on Lambda. For example, for Lithops we use runtimes for python >= 3.6 that come with already preinstalled modules. A *layer* is a set of packaged dependencies that can be used by multiple runtimes. For example, Lithops dependencies are deployed as a layer, so if multiple runtimes are created with different memory values, they can mount the same layer containing the dependencies, instead
An AWS Lambda *runtime* is a predefined environment to run code on Lambda. For example, for Lithops we use runtimes for Python >= 3.8 that come with already preinstalled modules. A *layer* is a set of packaged dependencies that can be used by multiple runtimes. For example, Lithops dependencies are deployed as a layer, so if multiple runtimes are created with different memory values, they can mount the same layer containing the dependencies, instead
of deploying them separately for each runtime.

[In this link](https://gist.github.com/gene1wood/4a052f39490fae00e0c3#gistcomment-3131227) you can find which modules are preinstalled by default in an AWS Lambda Python runtime. Moreover, Lithops runtime also ships with the following packages:
Expand Down Expand Up @@ -56,13 +56,13 @@ so that they can be used in the Lambda code.
To build your own runtime, first install [Docker CE](https://docs.docker.com/get-docker/) in your client machine.

Update the [template Dockerfile](Dockerfile) that better fits to your requirements with your required system packages and Python modules.
You can add a container layer (`RUN ...`) to install additional Python modules using `pip` or system libraries using `apt`, or even change Python version to a older/newer one.
You can add a container layer (`RUN ...`) to install additional Python modules using `pip` or system libraries using `apt`, or even change to an older or newer Python version.

If you plan to use the **ARM64** architecture, you should consider creating a new dockerfile with an arm image from [https://gallery.ecr.aws/lambda/python](https://gallery.ecr.aws/lambda/python), in the tab "image tags". For example, you should start the dockerfile with the line `FROM public.ecr.aws/lambda/python:3.9-arm64`

Then, to build the custom runtime, use `lithops runtime build` CLI specifying the modified `Dockerfile` file and a runtime name.
Note that you only need to specify the container name: `my-container-runtime-name`.
As far as possible, avoid using 'points' ('.') in the runtime name.
Avoid using dots ('.') in the runtime name when possible.

```
lithops runtime build -f MyDockerfile -b aws_lambda my-container-runtime-name
Expand Down
10 changes: 3 additions & 7 deletions runtime/azure_containers/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
# Python 3.6
#FROM python:3.6-slim-buster

# Python 3.7
#FROM python:3.7-slim-buster

# Python 3.8
#FROM python:3.8-slim-buster
#FROM python:3.8-slim-bookworm

# Python 3.9
FROM python:3.9-slim-buster
FROM python:3.9-slim-bookworm

# Python 3.10
#FROM python:3.10-slim-buster
#FROM python:3.10-slim-bookworm

RUN apt-get update && apt-get install -y \
zip \
Expand Down
Loading
Loading