Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

R4R: Tagged docker images #3694

Merged
merged 4 commits into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -331,9 +331,20 @@ jobs:
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push tendermint/gaia:$GAIAD_VERSION

# Push the tag also for the version, so clients can build up on top of it
GAIAD_VERSION=`/tmp/workspace/bin/gaiad version`
docker push tendermint/gaia:$GAIAD_VERSION
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed the hashed version, in favour of the git tag version that will run only when a new tag will be added

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not using git describe's output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed to me more readable to use $CIRCLE_TAG instead of getting the tag from a command.
In here the specific reason to change the behaviour was also to trigger the new job only when the tag is pushed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed to me more readable to use $CIRCLE_TAG instead of getting the tag from a command.

The risk is that versions may diverge. Did you check that gaiad version kinda looks like the image's actual version?

docker_tagged:
<<: *linux_defaults
steps:
- attach_workspace:
at: /tmp/workspace
- checkout
- setup_remote_docker:
docker_layer_caching: true
- run: |
docker build -t tendermint/gaiad:$CIRCLE_TAG --file ./Dockerfile.gaiad .
docker build -t tendermint/gaiacli:$CIRCLE_TAG --file ./Dockerfile.gaiacli .
docker login -u $DOCKER_USER -p $DOCKER_PASS
docker push tendermint/gaiad:$CIRCLE_TAG
docker push tendermint/gaiacli:$CIRCLE_TAG

workflows:
version: 2
Expand All @@ -347,6 +358,16 @@ workflows:
- develop
requires:
- setup_dependencies
- docker_tagged:
filters:
tags:
only:
- /^v.*/
branches:
ignore:
- /.*/
requires:
- setup_dependencies
- macos_ci:
filters:
branches:
Expand Down
30 changes: 30 additions & 0 deletions Dockerfile.gaiacli
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Simple usage with a mounted data directory:
# > docker build -t gaiacli .
FROM golang:alpine AS build-env

# Set up dependencies
ENV PACKAGES make git libc-dev bash gcc linux-headers eudev-dev

# Set working directory for the build
WORKDIR /go/src/github.com/cosmos/cosmos-sdk

# Add source files
COPY . .

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES && \
make tools && \
make vendor-deps && \
make build && \
make install

# Final image
FROM alpine:3.9

# Install ca-certificates
RUN apk add --update ca-certificates
WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/gaiacli /bin/gaiacli
ENTRYPOINT ["/bin/gaiacli"]
32 changes: 32 additions & 0 deletions Dockerfile.gaiad
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Simple usage with a mounted data directory:
# > docker build -t gaia .
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.gaiad:/root/.gaiad gaia gaiad init
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.gaiad:/root/.gaiad gaia gaiad start
FROM golang:alpine AS build-env

# Set up dependencies
ENV PACKAGES make git libc-dev bash gcc linux-headers eudev-dev

# Set working directory for the build
WORKDIR /go/src/github.com/cosmos/cosmos-sdk

# Add source files
COPY . .

# Install minimum necessary dependencies, build Cosmos SDK, remove packages
RUN apk add --no-cache $PACKAGES && \
make tools && \
make vendor-deps && \
make build && \
make install

# Final image
FROM alpine:3.9

# Install ca-certificates
RUN apk add --update ca-certificates
WORKDIR /root

# Copy over binaries from the build-env
COPY --from=build-env /go/bin/gaiad /bin/gaiad
ENTRYPOINT ["/bin/gaiad"]