Skip to content

Commit b47008b

Browse files
committed
dockerfile: fix hadolint code-scanning findings
Enable pipefail for piped RUN commands Quote apt package specs with variable expansions Add --no-install-recommends to package installs Pin bootstrap apt packages using explicit version patterns Consolidate consecutive RUN instructions
1 parent 6012c12 commit b47008b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,15 @@ LABEL maintainer="Citus Data https://citusdata.com" \
1414
ENV CITUS_VERSION ${VERSION}.citus-1
1515

1616
# install Citus
17+
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
1718
RUN apt-get update \
1819
&& apt-get install -y --no-install-recommends \
19-
ca-certificates \
20-
curl \
20+
ca-certificates=* \
21+
curl=* \
2122
&& curl -s https://install.citusdata.com/community/deb.sh | bash \
22-
&& apt-get install -y postgresql-$PG_MAJOR-citus-14.0=$CITUS_VERSION \
23-
postgresql-$PG_MAJOR-hll=2.19.citus-1 \
24-
postgresql-$PG_MAJOR-topn=2.7.0.citus-1 \
23+
&& apt-get install -y --no-install-recommends "postgresql-$PG_MAJOR-citus-14.0=$CITUS_VERSION" \
24+
"postgresql-$PG_MAJOR-hll=2.19.citus-1" \
25+
"postgresql-$PG_MAJOR-topn=2.7.0.citus-1" \
2526
&& apt-get purge -y --auto-remove curl \
2627
&& rm -rf /var/lib/apt/lists/*
2728

@@ -33,10 +34,10 @@ COPY 001-create-citus-extension.sql /docker-entrypoint-initdb.d/
3334

3435
# add health check script
3536
COPY pg_healthcheck wait-for-manager.sh /
36-
RUN chmod +x /wait-for-manager.sh
37+
RUN chmod +x /wait-for-manager.sh \
38+
&& sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh
3739

3840
# entry point unsets PGPASSWORD, but we need it to connect to workers
3941
# https://github.com/docker-library/postgres/blob/33bccfcaddd0679f55ee1028c012d26cd196537d/12/docker-entrypoint.sh#L303
40-
RUN sed "/unset PGPASSWORD/d" -i /usr/local/bin/docker-entrypoint.sh
4142

4243
HEALTHCHECK --interval=4s --start-period=6s CMD ./pg_healthcheck

0 commit comments

Comments
 (0)