Skip to content

Commit

Permalink
chore(Dockerfile): cleanup after installation a bit more than before …
Browse files Browse the repository at this point in the history
…and keep copyright / license files (#67)
  • Loading branch information
helgi committed Sep 27, 2016
1 parent fd8573f commit 32a7400
Showing 1 changed file with 34 additions and 21 deletions.
55 changes: 34 additions & 21 deletions rootfs/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,40 @@ FROM quay.io/deis/base:v0.3.4

COPY . /

RUN apt-get update \
&& apt-get install -y \
git \
golang \
make \
--no-install-recommends \
&& export DOCKER_REGISTRY_TAG=deis \
DOCKER_REGISTRY_REPO=https://github.com/deis/distribution.git \
DISTRIBUTION_DIR=/go/src/github.com/docker/distribution \
&& export GOPATH=/go:$DISTRIBUTION_DIR/Godeps/_workspace \
&& git clone -b $DOCKER_REGISTRY_TAG --single-branch $DOCKER_REGISTRY_REPO $DISTRIBUTION_DIR \
&& cd $DISTRIBUTION_DIR \
&& make binaries \
&& cp bin/* /bin/ \
&& rm -rf /go \
&& apt-get remove -y --auto-remove --purge \
git \
golang \
make \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
RUN buildDeps='git golang make'; \
apt-get update && \
apt-get install -y --no-install-recommends \
$buildDeps && \
export DOCKER_REGISTRY_TAG=deis \
DOCKER_REGISTRY_REPO=https://github.com/deis/distribution.git \
DISTRIBUTION_DIR=/go/src/github.com/docker/distribution && \
export GOPATH=/go:$DISTRIBUTION_DIR/Godeps/_workspace && \
git clone -b $DOCKER_REGISTRY_TAG --single-branch $DOCKER_REGISTRY_REPO $DISTRIBUTION_DIR && \
cd $DISTRIBUTION_DIR && \
make binaries && \
cp bin/* /bin/ && \
rm -rf /go && \
# cleanup
apt-get purge -y --auto-remove $buildDeps && \
apt-get autoremove -y && \
apt-get clean -y && \
# package up license files if any by appending to existing tar
COPYRIGHT_TAR='/usr/share/copyrights.tar'; \
gunzip $COPYRIGHT_TAR.gz; tar -rf $COPYRIGHT_TAR /usr/share/doc/*/copyright; gzip $COPYRIGHT_TAR && \
rm -rf \
/usr/share/doc \
/usr/share/man \
/usr/share/info \
/usr/share/locale \
/var/lib/apt/lists/* \
/var/log/* \
/var/cache/debconf/* \
/etc/systemd \
/lib/lsb \
/lib/udev \
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
bash -c "mkdir -p /usr/share/man/man{1..8}"

VOLUME ["/var/lib/registry"]
CMD ["/opt/registry/sbin/registry"]
Expand Down

0 comments on commit 32a7400

Please sign in to comment.