Skip to content

Commit

Permalink
Merge PR #1396: Dockerfile Update
Browse files Browse the repository at this point in the history
* Working dockerfile
* Fix typo
* Add deps for cgo support
  • Loading branch information
jackzampolin authored and cwgoes committed Jul 3, 2018
1 parent a6dc81d commit 85ba874
Showing 1 changed file with 23 additions and 22 deletions.
45 changes: 23 additions & 22 deletions Dockerfile
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"]

0 comments on commit 85ba874

Please sign in to comment.