Skip to content

Commit

Permalink
fix(dockerfiles/bases): shrink base image size (#431)
Browse files Browse the repository at this point in the history
add clean step to rmove `/var/cache/yum`.

Signed-off-by: wuhuizuo <[email protected]>

Signed-off-by: wuhuizuo <[email protected]>
  • Loading branch information
wuhuizuo authored Sep 23, 2024
1 parent 1e00bb8 commit 3c23267
Show file tree
Hide file tree
Showing 14 changed files with 33 additions and 20 deletions.
5 changes: 3 additions & 2 deletions dockerfiles/bases/ng-monitoring-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG PINGCAP_BASE
FROM $PINGCAP_BASE
RUN dnf install perl-interpreter -y && \
dnf clean all
RUN dnf install perl-interpreter -y \
&& dnf clean all \
&& rm -rf /var/cache/yum
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ FROM pingcap/centos-stream:8 AS arm64
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \
&& _date=20240919 dnf upgrade -y && dnf clean all \
&& _date=20240920 dnf upgrade -y && dnf clean all && rm -rf /var/cache/yum \
&& sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
Expand Down
5 changes: 3 additions & 2 deletions dockerfiles/bases/pd-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
ARG PINGCAP_BASE
FROM $PINGCAP_BASE
RUN dnf install bind-utils wget jq perl-interpreter -y && \
dnf clean all
RUN dnf install bind-utils wget jq perl-interpreter -y \
&& dnf clean all \
&& rm -rf /var/cache/yum
2 changes: 1 addition & 1 deletion dockerfiles/bases/pd-base/release-6.5.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM pingcap/centos-stream:8 AS arm64
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \
&& _date=20240919 dnf upgrade -y && dnf clean all \
&& _date=20240920 dnf upgrade -y && dnf clean all && rm -rf /var/cache/yum \
&& sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
2 changes: 1 addition & 1 deletion dockerfiles/bases/pingcap-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM quay.io/rockylinux/rockylinux:9.4.20240523
COPY --from=busybox:1.36.1 /bin/busybox /bin/busybox
RUN _date=20240730 dnf upgrade -y && dnf clean all
RUN _date=20240920 dnf upgrade -y && dnf clean all && rm -rf /var/cache/yum
6 changes: 3 additions & 3 deletions dockerfiles/bases/skaffold.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ build:
cache: {}
tagPolicy:
customTemplate:
template: "v1.9.1"
template: "v1.9.2"
cluster:
concurrency: 0
randomDockerConfigSecret: false
Expand Down Expand Up @@ -118,7 +118,7 @@ build:
cache: {}
tagPolicy:
customTemplate:
template: "v1.9.1-fips"
template: "v1.9.2-fips"
cluster:
concurrency: 0
randomDockerConfigSecret: false
Expand Down Expand Up @@ -202,7 +202,7 @@ build:
path: tools-base/release-6.5.Dockerfile
tagPolicy:
customTemplate:
template: "v1.0.1-old"
template: "v1.0.2-old"
local:
useDockerCLI: true
useBuildkit: true
Expand Down
4 changes: 3 additions & 1 deletion dockerfiles/bases/tidb-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG PINGCAP_BASE
FROM $PINGCAP_BASE
RUN dnf install --allowerasing -y curl wget && dnf clean all
RUN dnf install --allowerasing -y curl wget \
&& dnf clean all \
&& rm -rf /var/cache/yum
7 changes: 4 additions & 3 deletions dockerfiles/bases/tidb-base/release-6.5.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@ FROM pingcap/centos-stream:8 AS arm64
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \
&& _date=20240919 dnf upgrade -y && dnf clean all \
&& _date=20240920 dnf upgrade -y && dnf clean all && rm -rf /var/cache/yum \
&& sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
RUN set -e && \
dnf install bind-utils curl nmap-ncat -y && \
dnf clean all
dnf install bind-utils curl nmap-ncat -y \
&& dnf clean all \
&& rm -rf /var/cache/yum
4 changes: 3 additions & 1 deletion dockerfiles/bases/tiflash-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG PINGCAP_BASE
FROM $PINGCAP_BASE
RUN dnf install --allowerasing -y wget && dnf clean all
RUN dnf install --allowerasing -y wget \
&& dnf clean all \
&& rm -rf /var/cache/yum
4 changes: 3 additions & 1 deletion dockerfiles/bases/tikv-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARG PINGCAP_BASE
FROM $PINGCAP_BASE
# wget is requested by operator
RUN dnf install -y tzdata wget && dnf clean all
RUN dnf install -y tzdata wget \
&& dnf clean all \
&& rm -rf /var/cache/yum
ENV TZ=/etc/localtime \
TZDIR=/usr/share/zoneinfo
4 changes: 3 additions & 1 deletion dockerfiles/bases/tikv-base/fips.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
ARG PINGCAP_BASE=ghcr.io/pingcap-qe/bases/pingcap-base:v1.9.1
FROM $PINGCAP_BASE
# wget is requested by operator
RUN dnf install -y tzdata wget openssl && dnf clean all
RUN dnf install -y tzdata wget openssl \
&& dnf clean all \
&& rm -rf /var/cache/yum
ENV TZ=/etc/localtime \
TZDIR=/usr/share/zoneinfo
2 changes: 1 addition & 1 deletion dockerfiles/bases/tikv-base/release-6.5.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ FROM pingcap/centos-stream:8 AS arm64
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \
&& _date=20240919 dnf upgrade -y && dnf clean all \
&& _date=20240920 dnf upgrade -y && dnf clean all && rm -rf /var/cache/yum \
&& sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
Expand Down
4 changes: 3 additions & 1 deletion dockerfiles/bases/tools-base/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG PINGCAP_BASE
FROM $PINGCAP_BASE
RUN dnf install -y bind-utils wget nc && dnf clean all
RUN dnf install -y bind-utils wget nc \
&& dnf clean all \
&& rm -rf /var/cache/yum
2 changes: 1 addition & 1 deletion dockerfiles/bases/tools-base/release-6.5.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ FROM pingcap/centos-stream:8 AS arm64
RUN sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo \
&& _date=20240919 dnf upgrade -y && dnf clean all \
&& _date=20240920 dnf upgrade -y && dnf clean all && rm -rf /var/cache/yum \
&& sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo \
&& sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo \
&& sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
Expand Down

0 comments on commit 3c23267

Please sign in to comment.