Skip to content

Commit 695354d

Browse files
fix(build): Update dockerfile to use cache busting and reduce image size (#8652)
This PR fixes issue in building docker-images during CI and releases. It uses cache busting to ensure `apt-get update` is always run. It also reduces the image size by removing `/var/lib/apt/lists`
1 parent 43f1d8a commit 695354d

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

contrib/Dockerfile

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,19 @@ LABEL maintainer="Dgraph Labs <contact@dgraph.io>"
1313
RUN rm -rf /var/lib/apt/lists/*
1414

1515
# only update, don't run upgrade
16-
RUN apt-get update
17-
# pin package versions always & bring in CVE fixes as needed
18-
RUN apt-get install -y --no-install-recommends ca-certificates
19-
RUN apt-get install -y --no-install-recommends curl
20-
RUN apt-get install -y --no-install-recommends htop
21-
RUN apt-get install -y --no-install-recommends iputils-ping
22-
RUN apt-get install -y --no-install-recommends jq
23-
RUN apt-get install -y --no-install-recommends less
24-
RUN apt-get install -y --no-install-recommends sysstat
16+
# use cache busting to avoid old versions
17+
# remove /var/lib/apt/lists/* to reduce image size.
18+
# see: https://docs.docker.com/develop/develop-images/dockerfile_best-practices
19+
RUN apt-get update && apt-get install -y --no-install-recommends \
20+
ca-certificates \
21+
htop \
22+
curl \
23+
htop \
24+
iputils-ping \
25+
jq \
26+
less \
27+
sysstat \
28+
&& rm -rf /var/lib/apt/lists/*
2529

2630
ADD linux /usr/local/bin
2731

0 commit comments

Comments
 (0)