Skip to content

Commit

Permalink
Support UPGRADE_PACKAGES for alpine images
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 Aug 8, 2024
1 parent 6963576 commit d64ee94
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 5 additions & 2 deletions template/python3-flask/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-alpine A
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog

ARG UPGRADE_PACKAGES=false

ARG ADDITIONAL_PACKAGE
# Alternatively use ADD https:// (which will not be cached by Docker builder)

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

# Add non root user
# Add non root user
RUN addgroup -S app && adduser app -S -G app
RUN chown app /home/app

Expand Down
4 changes: 3 additions & 1 deletion template/python3-http/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ FROM --platform=${TARGETPLATFORM:-linux/amd64} python:${PYTHON_VERSION}-alpine A
COPY --from=watchdog /fwatchdog /usr/bin/fwatchdog
RUN chmod +x /usr/bin/fwatchdog

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

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

# Add non root user
RUN addgroup -S app && adduser app -S -G app
Expand Down

0 comments on commit d64ee94

Please sign in to comment.