Skip to content

Commit d64ee94

Browse files
committed
Support UPGRADE_PACKAGES for alpine images
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <[email protected]>
1 parent 6963576 commit d64ee94

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

template/python3-flask/Dockerfile

+5-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-alpine A
55
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
66
RUN chmod +x /usr/bin/fwatchdog
77

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

11-
RUN apk --no-cache add openssl-dev ${ADDITIONAL_PACKAGE}
13+
RUN if [ "${UPGRADE_PACKAGES}" = "true" ] || [ "${UPGRADE_PACKAGES}" = "1" ]; then apk --no-cache upgrade; fi && \
14+
apk --no-cache add openssl-dev ${ADDITIONAL_PACKAGE}
1215

13-
# Add non root user
16+
# Add non root user
1417
RUN addgroup -S app && adduser app -S -G app
1518
RUN chown app /home/app
1619

template/python3-http/Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-alpine A
55
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
66
RUN chmod +x /usr/bin/fwatchdog
77

8+
ARG UPGRADE_PACKAGES
89
ARG ADDITIONAL_PACKAGE
910
# Alternatively use ADD https:// (which will not be cached by Docker builder)
1011

11-
RUN apk --no-cache add ${ADDITIONAL_PACKAGE}
12+
RUN if [ "${UPGRADE_PACKAGES}" = "true" ] || [ "${UPGRADE_PACKAGES}" = "1" ]; then apk --no-cache upgrade; fi && \
13+
apk --no-cache add ${ADDITIONAL_PACKAGE}
1214

1315
# Add non root user
1416
RUN addgroup -S app && adduser app -S -G app

0 commit comments

Comments
 (0)