Skip to content

Commit

Permalink
Dockerfiles: Remove dependency on awk
Browse files Browse the repository at this point in the history
awk is used to strip the trailing '/' from the output of du used to
estimate size savings in the container build. If a container release
doesn't include awk, it will fail here, and awk is totally unnecessary,
as bash string manipulation can work in its place.

Signed-off-by: Blaine Gardner <[email protected]>
  • Loading branch information
BlaineEXE authored and leseb committed Apr 26, 2018
1 parent 52672ea commit da37788
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/daemon-base/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ RUN \
# download and install packages from web, cleaning any files as you go.
# Installs should support install of ganesha for luminous without installing for jewel/kraken.
__DOCKERFILE_INSTALL__ && \
# Clean container, starting with record of current size
INITIAL_SIZE=$(du -sm / 2>/dev/null | awk '{print $1}') && \
# Clean container, starting with record of current size (strip / from end)
INITIAL_SIZE="$(bash -c 'sz="$(du -sm --exclude=/proc /)" ; echo "${sz%*/}"')" && \
#
#
# Perform any final cleanup actions like package manager cleaning, etc.
Expand All @@ -33,8 +33,8 @@ RUN \
__DOCKERFILE_CLEAN_COMMON__ && \
#
#
# Report size savings
FINAL_SIZE=$(du -sm / 2>/dev/null | awk '{print $1}') && \
# Report size savings (strip / from end)
FINAL_SIZE="$(bash -c 'sz="$(du -sm --exclude=/proc /)" ; echo "${sz%*/}"')" && \
REMOVED_SIZE=$((INITIAL_SIZE - FINAL_SIZE)) && \
echo "Cleaning process removed ${REMOVED_SIZE}MB" && \
echo "Dropped container size from ${INITIAL_SIZE}MB to ${FINAL_SIZE}MB"
8 changes: 4 additions & 4 deletions src/daemon/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ RUN \
# Typical workflow: add new repos; refresh repos; install packages; package-manager clean;
# download and install packages from web, cleaning any files as you go.
__DOCKERFILE_INSTALL__ && \
# Clean container, starting with record of current size
INITIAL_SIZE=$(du -sm / 2>/dev/null | awk '{print $1}') && \
# Clean container, starting with record of current size (strip / from end)
INITIAL_SIZE="$(bash -c 'sz="$(du -sm --exclude=/proc /)" ; echo "${sz%*/}"')" && \
#
#
# Perform any final cleanup actions like package manager cleaning, etc.
Expand All @@ -28,8 +28,8 @@ RUN \
__DOCKERFILE_CLEAN_COMMON__ && \
#
#
# Report size savings
FINAL_SIZE=$(du -sm / 2>/dev/null | awk '{print $1}') && \
# Report size savings (strip / from end)
FINAL_SIZE="$(bash -c 'sz="$(du -sm --exclude=/proc /)" ; echo "${sz%*/}"')" && \
REMOVED_SIZE=$((INITIAL_SIZE - FINAL_SIZE)) && \
echo "Cleaning process removed ${REMOVED_SIZE}MB" && \
echo "Dropped container size from ${INITIAL_SIZE}MB to ${FINAL_SIZE}MB"
Expand Down

0 comments on commit da37788

Please sign in to comment.