Skip to content

Commit

Permalink
New dockerfile that can build by itself
Browse files Browse the repository at this point in the history
Previously, we'd build a glibc Relay locally and then stuff that into a
minimal Docker image and provide that. Now, we do the build of Relay
inside the image build itself. I have confirmed that an executable built
in this Alpine image runs fine in a Debian (i.e., glibc) system.

However, this results in a larger image size right now. Compare the
previous sizes to what is currently built by this commit:

| Image    | Compressed | Uncompressed |
| -------- | ---------- | ------------ |
| Previous | 6 MB       | 19.9 MB      |
| Current  | 31 MB      | 82.4 MB      |

This allows us to easily automate the build with DockerHub, though,
because it doesn't require anything besides the Dockerfile.

See operable/cog#1384 for more.
  • Loading branch information
christophermaier committed Apr 17, 2017
1 parent 726704b commit 99481c5
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
FROM alpine:3.4

MAINTAINER Kevin Smith <[email protected]>
MAINTAINER Christopher Maier <[email protected]>

# Bake in a directory that we can use for logging, config, etc.
RUN mkdir -p /var/operable/relay
ENV GO_PACKAGE_VERSION 1.6.3-r0
ENV GOPATH /gopath
ENV PATH=${GOPATH}/bin:${PATH}

# Relies on the binary having already been built
COPY _build/relay /usr/local/bin
COPY docker/relay.conf /usr/local/etc/relay.conf
WORKDIR /gopath/src/github.com/operable/go-relay
COPY . /gopath/src/github.com/operable/go-relay

RUN apk -U add \
go=$GO_PACKAGE_VERSION \
go-tools=$GO_PACKAGE_VERSION \
git make && \

go get -u github.com/kardianos/govendor && \
make exe && \

mv _build/relay /usr/local/bin && \
mkdir -p /usr/local/etc && \
cp docker/relay.conf /usr/local/etc/relay.conf && \

# Provide a place to dump log files, etc.
mkdir -p /var/operable/relay && \

apk del go go-tools git make && \
rm -Rf $GOPATH

0 comments on commit 99481c5

Please sign in to comment.