Use docke-squash to make a smaller base image.

This commit is contained in:
Shuai Lin 2016-11-25 14:56:23 +08:00
parent acf1a5e77a
commit 49e15df129
2 changed files with 21 additions and 2 deletions

View file

@ -1,6 +1,7 @@
server_version=6.0.5 server_version=6.0.5
base_image=seafileorg/base:16.04 base_image=seafileorg/base:16.04
base_image_squashed=seafileorg/base:16.04-squashed
server_image=seafileorg/server:$(server_version) server_image=seafileorg/server:$(server_version)
all: all:
@ -14,6 +15,10 @@ base:
server: server:
cd seafile && docker build -t $(server_image) . cd seafile && docker build -t $(server_image) .
squash-base:
docker-squash --verbose --tag $(base_image_squashed) $(base_image)
docker tag $(base_image_squashed) $(base_image)
push: push:
docker push $(base_image) docker push $(base_image)
docker push $(server_image) docker push $(server_image)

View file

@ -38,7 +38,21 @@ RUN mkdir -p /etc/service/mysql && \
RUN mkdir -p /etc/my_init.d && rm -f /etc/my_init.d/00_regen_ssh_host_keys.sh RUN mkdir -p /etc/my_init.d && rm -f /etc/my_init.d/00_regen_ssh_host_keys.sh
ADD my_init.d/99_mysql_setup.sh /etc/my_init.d/ ADD my_init.d/99_mysql_setup.sh /etc/my_init.d/
# clean up for docker squash
RUN rm -rf \
/root/.cache \
/root/.npm \
/root/.pip \
/usr/local/share/doc \
/usr/share/doc \
/usr/share/man \
/usr/share/vim/vim74/doc \
/usr/share/vim/vim74/lang \
/usr/share/vim/vim74/spell/en*
/usr/share/vim/vim74/tutor \
/var/lib/apt/lists/* \
/tmp/* \
CMD ["/sbin/my_init", "--", "bash", "-l"] CMD ["/sbin/my_init", "--", "bash", "-l"]
# TODO: clean up & squash layers with docker-squash # Docker squash
# See https://github.com/jwilder/docker-squash