Skip to content

Commit 32a7400

Browse files
authored
chore(Dockerfile): cleanup after installation a bit more than before and keep copyright / license files (#67)
1 parent fd8573f commit 32a7400

1 file changed

Lines changed: 34 additions & 21 deletions

File tree

rootfs/Dockerfile

Lines changed: 34 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,40 @@ FROM quay.io/deis/base:v0.3.4
22

33
COPY . /
44

5-
RUN apt-get update \
6-
&& apt-get install -y \
7-
git \
8-
golang \
9-
make \
10-
--no-install-recommends \
11-
&& export DOCKER_REGISTRY_TAG=deis \
12-
DOCKER_REGISTRY_REPO=https://github.com/deis/distribution.git \
13-
DISTRIBUTION_DIR=/go/src/github.com/docker/distribution \
14-
&& export GOPATH=/go:$DISTRIBUTION_DIR/Godeps/_workspace \
15-
&& git clone -b $DOCKER_REGISTRY_TAG --single-branch $DOCKER_REGISTRY_REPO $DISTRIBUTION_DIR \
16-
&& cd $DISTRIBUTION_DIR \
17-
&& make binaries \
18-
&& cp bin/* /bin/ \
19-
&& rm -rf /go \
20-
&& apt-get remove -y --auto-remove --purge \
21-
git \
22-
golang \
23-
make \
24-
&& apt-get clean \
25-
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/man /usr/share/doc
5+
RUN buildDeps='git golang make'; \
6+
apt-get update && \
7+
apt-get install -y --no-install-recommends \
8+
$buildDeps && \
9+
export DOCKER_REGISTRY_TAG=deis \
10+
DOCKER_REGISTRY_REPO=https://github.com/deis/distribution.git \
11+
DISTRIBUTION_DIR=/go/src/github.com/docker/distribution && \
12+
export GOPATH=/go:$DISTRIBUTION_DIR/Godeps/_workspace && \
13+
git clone -b $DOCKER_REGISTRY_TAG --single-branch $DOCKER_REGISTRY_REPO $DISTRIBUTION_DIR && \
14+
cd $DISTRIBUTION_DIR && \
15+
make binaries && \
16+
cp bin/* /bin/ && \
17+
rm -rf /go && \
18+
# cleanup
19+
apt-get purge -y --auto-remove $buildDeps && \
20+
apt-get autoremove -y && \
21+
apt-get clean -y && \
22+
# package up license files if any by appending to existing tar
23+
COPYRIGHT_TAR='/usr/share/copyrights.tar'; \
24+
gunzip $COPYRIGHT_TAR.gz; tar -rf $COPYRIGHT_TAR /usr/share/doc/*/copyright; gzip $COPYRIGHT_TAR && \
25+
rm -rf \
26+
/usr/share/doc \
27+
/usr/share/man \
28+
/usr/share/info \
29+
/usr/share/locale \
30+
/var/lib/apt/lists/* \
31+
/var/log/* \
32+
/var/cache/debconf/* \
33+
/etc/systemd \
34+
/lib/lsb \
35+
/lib/udev \
36+
/usr/lib/x86_64-linux-gnu/gconv/IBM* \
37+
/usr/lib/x86_64-linux-gnu/gconv/EBC* && \
38+
bash -c "mkdir -p /usr/share/man/man{1..8}"
2639

2740
VOLUME ["/var/lib/registry"]
2841
CMD ["/opt/registry/sbin/registry"]

0 commit comments

Comments
 (0)