Skip to content

Commit 6963576

Browse files
committedAug 8, 2024
Add UPGRADE_PACKAGES for Debian-based templates
The UPGRADE_PACKAGES build_arg will invoke an apt upgrade to help with warnings generated from CVE / image scanners. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 919525e commit 6963576

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed
 

‎template/python3-flask-debian/Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
ARG PYTHON_VERSION=3.12
22
ARG DEBIAN_OS=slim-bookworm
3+
ARG UPGRADE_PACKAGES=false
4+
35
FROM --platform=${TARGETPLATFORM:-linux/amd64} ghcr.io/openfaas/of-watchdog:0.10.4 AS watchdog
46
FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-${DEBIAN_OS} AS build
57

@@ -9,8 +11,9 @@ RUN chmod +x /usr/bin/fwatchdog
911
ARG ADDITIONAL_PACKAGE
1012
# Alternatively use ADD https:// (which will not be cached by Docker builder)
1113

12-
RUN apt-get -qy update \
13-
&& apt-get -qy install gcc make ${ADDITIONAL_PACKAGE} \
14+
RUN apt-get update -qy \
15+
&& if [ "${UPGRADE_PACKAGES}" = "true" ] || [ "${UPGRADE_PACKAGES}" = "1" ]; then apt-get upgrade -qy; fi \
16+
&& apt-get install -qy --no-install-recommends gcc make ${ADDITIONAL_PACKAGE} \
1417
&& rm -rf /var/lib/apt/lists/*
1518

1619
# Add non root user

‎template/python3-http-debian/Dockerfile

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

@@ -8,9 +10,11 @@ RUN chmod +x /usr/bin/fwatchdog
810

911
ARG ADDITIONAL_PACKAGE
1012
# Alternatively use ADD https:// (which will not be cached by Docker builder)
13+
ARG UPGRADE_PACKAGES=false
1114

12-
RUN apt-get -qy update \
13-
&& apt-get -qy install ${ADDITIONAL_PACKAGE} \
15+
RUN apt-get update -qy \
16+
&& if [ "${UPGRADE_PACKAGES}" = "true" ] || [ "${UPGRADE_PACKAGES}" = "1" ]; then apt-get upgrade -qy; fi \
17+
&& apt-get install -qy --no-install-recommends gcc make ${ADDITIONAL_PACKAGE} \
1418
&& rm -rf /var/lib/apt/lists/*
1519

1620
# Add non root user

0 commit comments

Comments
 (0)
Please sign in to comment.