-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build in a golang-based container, then copy resulting binaries into a minimal alpine-based container
- Loading branch information
Showing
1 changed file
with
20 additions
and
4 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,26 @@ | ||
FROM golang:latest AS build | ||
|
||
RUN mkdir -p /go/src/github.com/nsqio/nsq | ||
COPY . /go/src/github.com/nsqio/nsq | ||
|
||
WORKDIR /go/src/github.com/nsqio/nsq | ||
|
||
RUN wget -O /bin/dep https://github.com/golang/dep/releases/download/v0.3.2/dep-linux-amd64 \ | ||
&& chmod +x /bin/dep \ | ||
&& /bin/dep ensure \ | ||
&& ./test.sh \ | ||
&& CGO_ENABLED=0 make DESTDIR=/opt PREFIX=/nsq GOFLAGS='-ldflags="-s -w"' install | ||
|
||
FROM alpine:3.6 | ||
|
||
EXPOSE 4150 4151 4160 4161 4170 4171 | ||
|
||
VOLUME /data | ||
VOLUME /etc/ssl/certs | ||
# Optional volumes | ||
# /data - used for persistent storage across reboots | ||
# VOLUME /data | ||
# /etc/ssl/certs - directory for SSL certificates | ||
# VOLUME /etc/ssl/certs | ||
|
||
COPY dist/docker/bin/ /usr/local/bin/ | ||
COPY --from=build /opt/nsq/bin/ /usr/local/bin/ | ||
RUN ln -s /usr/local/bin/*nsq* / \ | ||
&& ln -s /usr/local/bin/*nsq* /bin/ | ||
&& ln -s /usr/local/bin/*nsq* /bin/ |