Skip to content

Commit

Permalink
Update Debian OS version for newer Python version
Browse files Browse the repository at this point in the history
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
  • Loading branch information
alexellis committed Jul 16, 2024
1 parent eb5fb46 commit d78fec9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The `witness` HTTP server is used along with Flask for all templates.
Are you referencing pip modules which require a native build toolchain? It's advisable to use the template with a `-debian` suffix in this case. The Debian images are larger, however they are usually more efficient for use with modules like `numpy` and `pandas`.

## Python Versioning

We try to keep the default Python 3 version up-to-date, however, you can specify a specific python version using the `PYTHON_VERSION` build argument.

The current stable version of Python is 3.12, you might want to test the next pre-release using:
Expand Down Expand Up @@ -64,6 +65,8 @@ This can also be set using the `--build-arg` flag.
faas-cli build --build-arg PYTHON_VERSION=3.12
```

For the `-debian` templates, the `DEBIAN_OS` build_args is also available to specify the Debian version. The default is currently `bookworm`.

## Downloading the templates

Using template pull with the repository's URL:
Expand Down
5 changes: 3 additions & 2 deletions template/python3-flask-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG PYTHON_VERSION=3.12
ARG DEBIAN_OS=slim-bookworm
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.4 AS watchdog
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-slim-buster AS build
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-${DEBIAN_OS} AS build

COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog
Expand All @@ -14,7 +15,7 @@ RUN apt-get -qy update \

# Add non root user
RUN addgroup --system app && adduser app --system --ingroup app
RUN chown app /home/app
RUN mkdir -p /home/app && chown app /home/app

USER app

Expand Down
5 changes: 3 additions & 2 deletions template/python3-http-debian/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
ARG PYTHON_VERSION=3.12
ARG DEBIAN_OS=slim-bookworm
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.4 AS watchdog
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-slim-buster AS build
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-${DEBIAN_OS} AS build

COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog
Expand All @@ -14,7 +15,7 @@ RUN apt-get -qy update \

# Add non root user
RUN addgroup --system app && adduser app --system --ingroup app
RUN chown app /home/app
RUN mkdir -p /home/app && chown app /home/app

USER app

Expand Down

0 comments on commit d78fec9

Please sign in to comment.