Skip to content

Commit 79f1d8e

Browse files
committed
ref(tests/etcdutils): optimize test-etcd Dockerfile
Reduces the virtual size of "deis/test-etcd" from 467.4MB to 200.8MB.
1 parent 08d97fa commit 79f1d8e

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

tests/etcdutils/Dockerfile

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
FROM ubuntu:12.04
2-
MAINTAINER Matt Boersma <matt@opdemand.com>
32

4-
# Install prerequisites: wget, git, and go.
5-
RUN apt-get update -q && DEBIAN_FRONTEND=noninteractive apt-get install -qy wget git-core
6-
RUN wget -qO- https://storage.googleapis.com/golang/go1.3.1.linux-amd64.tar.gz | tar -C /usr/local -xz
7-
ENV PATH /usr/local/go/bin:$PATH
8-
9-
# Build etcd v0.4.6. Keep this in sync with Deis' version.
10-
RUN git clone -q https://github.com/coreos/etcd.git /opt/etcd
11-
RUN cd /opt/etcd && git checkout -q v0.4.6 && ./build
12-
13-
# Download latest stable etcdctl. Keep this in sync with Deis' version.
3+
# Download etcdctl binary -- keep in sync with CoreOS' version.
144
ADD https://s3-us-west-2.amazonaws.com/opdemand/etcdctl-v0.4.6 /usr/local/bin/etcdctl
155
RUN chmod +x /usr/local/bin/etcdctl
166

7+
# build etcd and then clean up
8+
RUN buildDeps='curl git-core'; \
9+
set -x; \
10+
export DEBIAN_FRONTEND=noninteractive; \
11+
apt-get update && apt-get install -y $buildDeps --no-install-recommends \
12+
&& curl -sSL https://storage.googleapis.com/golang/go1.3.1.linux-amd64.tar.gz | tar -C /usr/local -xz \
13+
&& git clone -q https://github.com/coreos/etcd.git /opt/etcd \
14+
&& cd /opt/etcd && git checkout -q v0.4.6 && PATH=/usr/local/go/bin:$PATH ./build \
15+
&& cp /opt/etcd/bin/etcd /usr/local/bin \
16+
&& cd && rm -rf /usr/local/go /opt/etcd \
17+
&& apt-get purge -y $buildDeps \
18+
&& apt-get autoremove -y && apt-get clean
19+
1720
EXPOSE 4001 7001
18-
CMD ["/opt/etcd/bin/etcd"]
21+
CMD ["/usr/local/bin/etcd"]

0 commit comments

Comments
 (0)