-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Working dockerfile * Fix typo * Add deps for cgo support
- Loading branch information
1 parent
a6dc81d
commit 85ba874
Showing
1 changed file
with
23 additions
and
22 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,34 +1,35 @@ | ||
# Simple usage with a mounted data directory: | ||
# > docker build -t gaia . | ||
# > docker run -v $HOME/.gaiad:/root/.gaiad gaia init | ||
# > docker run -v $HOME/.gaiad:/root/.gaiad gaia start | ||
|
||
FROM alpine:edge | ||
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli gaia gaiad init | ||
# > docker run -it -p 46657:46657 -p 46656:46656 -v ~/.gaiad:/root/.gaiad -v ~/.gaiacli:/root/.gaiacli gaia gaiad start | ||
FROM golang:alpine AS build-env | ||
|
||
# Set up dependencies | ||
ENV PACKAGES go glide make git libc-dev bash | ||
|
||
# Set up GOPATH & PATH | ||
|
||
ENV GOPATH /root/go | ||
ENV BASE_PATH $GOPATH/src/github.com/cosmos | ||
ENV REPO_PATH $BASE_PATH/cosmos-sdk | ||
ENV WORKDIR /cosmos/ | ||
ENV PATH $GOPATH/bin:$PATH | ||
|
||
# Link expected Go repo path | ||
ENV PACKAGES make git libc-dev bash gcc linux-headers eudev-dev | ||
|
||
RUN mkdir -p $WORKDIR $GOPATH/pkg $ $GOPATH/bin $BASE_PATH | ||
# Set working directory for the build | ||
WORKDIR /go/src/github.com/cosmos/cosmos-sdk | ||
|
||
# Add source files | ||
|
||
ADD . $REPO_PATH | ||
COPY . . | ||
|
||
# Install minimum necessary dependencies, build Cosmos SDK, remove packages | ||
RUN apk add --no-cache $PACKAGES && \ | ||
cd $REPO_PATH && make get_tools && make get_vendor_deps && make build && make install && \ | ||
apk del $PACKAGES | ||
make get_tools && \ | ||
make get_vendor_deps && \ | ||
make build && \ | ||
make install | ||
|
||
# Final image | ||
FROM alpine:edge | ||
|
||
# Install ca-certificates | ||
RUN apk add --update ca-certificates | ||
WORKDIR /root | ||
|
||
# Set entrypoint | ||
# Copy over binaries from the build-env | ||
COPY --from=build-env /go/bin/gaiad /usr/bin/gaiad | ||
COPY --from=build-env /go/bin/gaiacli /usr/bin/gaiacli | ||
|
||
ENTRYPOINT ["gaiad"] | ||
# Run gaiad by default, omit entrypoint to ease using container with gaiacli | ||
CMD ["gaiad"] |