Skip to content

Commit d78fec9

Browse files
committed
Update Debian OS version for newer Python version
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent eb5fb46 commit d78fec9

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

README.md

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The `witness` HTTP server is used along with Flask for all templates.
3333
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`.
3434

3535
## Python Versioning
36+
3637
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.
3738

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

68+
For the `-debian` templates, the `DEBIAN_OS` build_args is also available to specify the Debian version. The default is currently `bookworm`.
69+
6770
## Downloading the templates
6871

6972
Using template pull with the repository's URL:

template/python3-flask-debian/Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG PYTHON_VERSION=3.12
2+
ARG DEBIAN_OS=slim-bookworm
23
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.4 AS watchdog
3-
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-slim-buster AS build
4+
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-${DEBIAN_OS} AS build
45

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

1516
# Add non root user
1617
RUN addgroup --system app && adduser app --system --ingroup app
17-
RUN chown app /home/app
18+
RUN mkdir -p /home/app && chown app /home/app
1819

1920
USER app
2021

template/python3-http-debian/Dockerfile

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
ARG PYTHON_VERSION=3.12
2+
ARG DEBIAN_OS=slim-bookworm
23
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.4 AS watchdog
3-
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-slim-buster AS build
4+
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-${DEBIAN_OS} AS build
45

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

1516
# Add non root user
1617
RUN addgroup --system app && adduser app --system --ingroup app
17-
RUN chown app /home/app
18+
RUN mkdir -p /home/app && chown app /home/app
1819

1920
USER app
2021

0 commit comments

Comments
 (0)