Skip to content

Commit

Permalink
use "-o pipefail" for RUN commands in modules Dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
netsandbox authored and thresheek committed Feb 6, 2024
1 parent 77dafa6 commit 5b7624a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
11 changes: 5 additions & 6 deletions modules/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ FROM ${NGINX_FROM_IMAGE} as builder

ARG ENABLED_MODULES

RUN set -ex \
&& if [ "$ENABLED_MODULES" = "" ]; then \
SHELL ["/bin/bash", "-exo", "pipefail", "-c"]

RUN if [ "$ENABLED_MODULES" = "" ]; then \
echo "No additional modules enabled, exiting"; \
exit 1; \
fi

COPY ./ /modules/

RUN set -ex \
&& apt-get update \
RUN apt-get update \
&& apt-get install -y --no-install-suggests --no-install-recommends \
patch make wget mercurial devscripts debhelper dpkg-dev \
quilt lsb-release build-essential libxml2-utils xsltproc \
Expand Down Expand Up @@ -71,8 +71,7 @@ RUN set -ex \

FROM ${NGINX_FROM_IMAGE}
RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder \
set -ex \
&& apt-get update \
apt-get update \
&& . /tmp/packages/modules.env \
&& for module in $BUILT_MODULES; do \
apt-get install --no-install-suggests --no-install-recommends -y /tmp/packages/nginx-module-${module}_${NGINX_VERSION}*.deb; \
Expand Down
11 changes: 5 additions & 6 deletions modules/Dockerfile.alpine
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ FROM ${NGINX_FROM_IMAGE} as builder

ARG ENABLED_MODULES

RUN set -ex \
&& if [ "$ENABLED_MODULES" = "" ]; then \
SHELL ["/bin/ash", "-exo", "pipefail", "-c"]

RUN if [ "$ENABLED_MODULES" = "" ]; then \
echo "No additional modules enabled, exiting"; \
exit 1; \
fi

COPY ./ /modules/

RUN set -ex \
&& apk update \
RUN apk update \
&& apk add linux-headers openssl-dev pcre2-dev zlib-dev openssl abuild \
musl-dev libxslt libxml2-utils make mercurial gcc unzip git \
xz g++ coreutils \
Expand Down Expand Up @@ -63,8 +63,7 @@ RUN set -ex \

FROM ${NGINX_FROM_IMAGE}
RUN --mount=type=bind,target=/tmp/packages/,source=/tmp/packages/,from=builder \
set -ex \
&& . /tmp/packages/modules.env \
. /tmp/packages/modules.env \
&& for module in $BUILT_MODULES; do \
apk add --no-cache --allow-untrusted /tmp/packages/nginx-module-${module}-${NGINX_VERSION}*.apk; \
done

0 comments on commit 5b7624a

Please sign in to comment.