Skip to content

Commit

Permalink
move RUN rm docker-clean command to diet image size
Browse files Browse the repository at this point in the history
This commit can reduce the size of docker images (7.28 GB to 6.33 GB
for humble) while keeping apt-get completion feature by moving
`RUN rm /etc/apt/apt.conf.d/docker-clean` to the later stage of Dockerfile.

We can close #152 when this commit will be merged as PR.

relate:
#152 (comment)
https://askubuntu.com/questions/86375/apt-get-autocompletion-of-package-name-is-broken
  • Loading branch information
takasehideki committed Apr 8, 2024
1 parent 8588c9a commit 0419f33
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
6 changes: 3 additions & 3 deletions foxy/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote'
RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades
RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport

# Enable apt-get completion
RUN rm /etc/apt/apt.conf.d/docker-clean

# Install Firefox
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \
echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \
Expand Down Expand Up @@ -111,6 +108,9 @@ RUN apt-get update -q && \
ros-${ROS_DISTRO}-ros-ign-gazebo && \
rm -rf /var/lib/apt/lists/*

# Enable apt-get completion after running `apt-get update` in the container
RUN rm /etc/apt/apt.conf.d/docker-clean

COPY ./entrypoint.sh /
ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ]

Expand Down
6 changes: 3 additions & 3 deletions humble/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote'
RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades
RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport

# Enable apt-get completion
RUN rm /etc/apt/apt.conf.d/docker-clean

# Install Firefox
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \
echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \
Expand Down Expand Up @@ -117,6 +114,9 @@ RUN if [ "$TARGETPLATFORM" = "linux/amd64" ]; then \
rm -rf /var/lib/apt/lists/*; \
fi

# Enable apt-get completion after running `apt-get update` in the container
RUN rm /etc/apt/apt.conf.d/docker-clean

COPY ./entrypoint.sh /
RUN dos2unix /entrypoint.sh
ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ]
Expand Down
6 changes: 3 additions & 3 deletions iron/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote'
RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades
RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport

# Enable apt-get completion
RUN rm /etc/apt/apt.conf.d/docker-clean

# Install Firefox
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \
echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \
Expand Down Expand Up @@ -117,6 +114,9 @@ RUN rosdep update
# rm -rf /var/lib/apt/lists/*; \
# fi

# Enable apt-get completion after running `apt-get update` in the container
RUN rm /etc/apt/apt.conf.d/docker-clean

COPY ./entrypoint.sh /
ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ]

Expand Down
6 changes: 3 additions & 3 deletions rolling/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ RUN sed -i "s/UI.initSetting('resize', 'off');/UI.initSetting('resize', 'remote'
RUN sed -i 's/Prompt=.*/Prompt=never/' /etc/update-manager/release-upgrades
RUN sed -i 's/enabled=1/enabled=0/g' /etc/default/apport

# Enable apt-get completion
RUN rm /etc/apt/apt.conf.d/docker-clean

# Install Firefox
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository ppa:mozillateam/ppa -y && \
echo 'Package: *' > /etc/apt/preferences.d/mozilla-firefox && \
Expand Down Expand Up @@ -117,6 +114,9 @@ RUN rosdep update
# rm -rf /var/lib/apt/lists/*; \
# fi

# Enable apt-get completion after running `apt-get update` in the container
RUN rm /etc/apt/apt.conf.d/docker-clean

COPY ./entrypoint.sh /
ENTRYPOINT [ "/bin/bash", "-c", "/entrypoint.sh" ]

Expand Down

0 comments on commit 0419f33

Please sign in to comment.