-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New dockerfile that can build by itself
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 | 30 MB | 81.6 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
1 parent
726704b
commit 8eb92aa
Showing
2 changed files
with
28 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,29 @@ | ||
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 --virtual .build_deps \ | ||
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 .build_deps && \ | ||
rm -Rf /var/cache/apk/* && \ | ||
rm -Rf $GOPATH |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters