Skip to content

Commit e5e527c

Browse files
committed
chore: quote some strings with variables and add comments
make sure that a space in a variable doesn't cause a problem. Also merge two RUN commands.
1 parent b1bdb61 commit e5e527c

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

scripts/Docker/Dockerfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,12 @@ ARG appdir
4646
WORKDIR $appdir
4747

4848
# Update to get security and other improvements;
49-
RUN apk --no-cache upgrade
50-
5149
# Add packages needed to compile mysql, pgsql and other python modules.
5250
# Can't use apk to add python packages as it installs for base image
5351
# in /usr.
5452
# g++ installs cc1plus needed by pip install
55-
RUN apk --no-cache add \
53+
RUN apk --no-cache upgrade; \
54+
apk --no-cache add \
5655
file \
5756
g++ \
5857
gcc \
@@ -83,22 +82,26 @@ COPY scripts/Docker/sphinxdeps.txt .
8382
# suppress warning when running pip as root
8483
ENV PIP_ROOT_USER_ACTION=ignore
8584

85+
# force embedded script to fail on any error "-e"
86+
# including in a pipeline (-o pipefail) (note pipefail
87+
# is not documented, but setting it isn;t an error and
88+
# works in testing)
8689
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
8790
ARG VERBOSE
8891
ARG pythonversion
8992

9093
RUN [ -z "${VERBOSE}" ] || set -xv; \
9194
CWD="$PWD" && \
92-
upgrades=$(python3 -m pip --no-cache-dir --disable-pip-version-check \
93-
list --outdated | awk 'NR > 2 {print $1}'); \
95+
upgrades="$(python3 -m pip --no-cache-dir --disable-pip-version-check \
96+
list --outdated | awk 'NR > 2 {print $1}')"; \
9497
if [ -n "$upgrades" ]; then \
9598
echo "Pip updating $upgrades"; \
9699
python -m pip --no-cache-dir --disable-pip-version-check \
97100
install -U $upgrades < /dev/null; \
98101
else \
99102
echo "Nothing to pip update"; \
100103
fi; \
101-
ls -l /usr/local/lib/python${pythonversion}/site-packages; \
104+
ls -l "/usr/local/lib/python${pythonversion}/site-packages"; \
102105
VER=$(apk list -I 'xapian-core-dev' | \
103106
sed 's/^xapian-core-dev-\([0-9.]*\)-.*/\1/') && \
104107
cd /tmp && \
@@ -211,8 +214,8 @@ RUN apk --no-cache upgrade; \
211214
libstdc++ \
212215
libxapian \
213216
zstd-libs; \
214-
upgrades=$(python3 -m pip --no-cache-dir --disable-pip-version-check \
215-
list --outdated | awk 'NR > 2 {print $1}'); \
217+
upgrades="$(python3 -m pip --no-cache-dir --disable-pip-version-check \
218+
list --outdated | awk 'NR > 2 {print $1}')"; \
216219
if [ -n "$upgrades" ]; then \
217220
echo "Pip updating $upgrades"; \
218221
python -m pip --no-cache-dir --disable-pip-version-check \

0 commit comments

Comments
 (0)