Skip to content

Commit

Permalink
Optimize Docker image
Browse files Browse the repository at this point in the history
* Remove and unpack TAR file in the same layer as the download
* Clean up more leftovers from installing curl
* Add .dockerignore to minimize build context to necessary files
  • Loading branch information
md5 committed Mar 1, 2015
1 parent 242875d commit e4aa0f3
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git
docker-gen
dist
*.gz
15 changes: 13 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,20 @@ FROM debian:wheezy
MAINTAINER Jason Wilder <jwilder@litl.com>

ENV VERSION 0.3.7
ENV DOWNLOAD_URL https://github.com/jwilder/docker-gen/releases/download/$VERSION/docker-gen-linux-amd64-$VERSION.tar.gz
ENV DOCKER_HOST unix:///tmp/docker.sock

RUN apt-get update && apt-get install -y curl && curl -o docker-gen-linux-amd64-$VERSION.tar.gz -L https://github.com/jwilder/docker-gen/releases/download/$VERSION/docker-gen-linux-amd64-$VERSION.tar.gz && apt-get remove -y curl && apt-get -y clean
RUN tar -C /usr/local/bin -xvzf docker-gen-linux-amd64-$VERSION.tar.gz && rm docker-gen-linux-amd64-$VERSION.tar.gz
RUN deps=' \
curl ca-certificates \
'; \
set -x; \
apt-get update \
&& apt-get install -y --no-install-recommends $deps \
&& curl -o docker-gen.tar.gz -L $DOWNLOAD_URL \
&& tar -C /usr/local/bin -xvzf docker-gen.tar.gz \
&& rm docker-gen.tar.gz \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $deps \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

ENTRYPOINT ["/usr/local/bin/docker-gen"]

0 comments on commit e4aa0f3

Please sign in to comment.