Skip to content

Commit

Permalink
Nightly docker builds, plus add a DOCKER_README
Browse files Browse the repository at this point in the history
  • Loading branch information
fastfadingviolets committed Jul 11, 2024
1 parent bdafda0 commit 1e6e363
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
name: Create and publish a Docker image

on:
push:
branches: ['main']
schedule:
- cron: "0 0 * * *"
release:
types: [published]
workflow_dispatch:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
**/go.sum
**/Makefile
Makefile
e2e.Dockerfile
Dockerfile
- name: Log in to the Container registry
uses: docker/[email protected]
Expand All @@ -48,12 +48,13 @@ jobs:
uses: docker/[email protected]
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
flavor: "latest=false"

- name: Build and push docker image
uses: docker/[email protected]
with:
context: .
file: e2e.Dockerfile
file: Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
42 changes: 42 additions & 0 deletions DOCKER_README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Gaia Docker image

There's a `gaia` docker image built on a nightly basis, as well as for every
release tag, and pushed to `ghcr.io/cosmos/gaia`. It's built from the
[`Dockerfile`](./Dockerfile) in this directory.

The images contain statically compiled `gaiad` binaries running on an `alpine`
container. By default, `gaiad` runs as user `nonroot`, with UID/GUID `1025`.
The image exposes ports `26656,26657,1317,9090`. This is how the `gaiad` is
compiled:

```Dockerfile
RUN LEDGER_ENABLED=false LINK_STATICALLY=true BUILD_TAGS=muslc make build
```

Since the image has an entrypoint of `gaiad start`, you can use it to start a
node by mounting in a `.gaia` config directory. So, for instance, you can start
a `v17.3.0` node running a chain configured at `$HOME/.gaia` by running:

```bash
docker run --rm -it -v "$HOME/.gaia:/opt/gaia" ghcr.io/cosmos/gaia:v17.3.0 --home /opt/gaia
```

Of course, you can also use the images to just run generic gaia commands:

```bash
docker run --rm -it --entrypoint gaiad -v "$HOME/.gaia:/opt/gaia" ghcr.io/cosmos/gaia:v17.3.0 q tendermint-validator-set --home /opt/gaia
```

## Building

The images are built by workflow
[docker-push.yml](./.github/workflows/docker-push.yml). This workflow is
invoked on release as well as every night, and may be invoked manually by
people to build an arbitrary branch. It uses the `docker/metadata-action` to
decide how to tag the image, according to the following rules:

* If invoked via schedule, the image is tagged `nightly` and `main` (since it's a build of the `main` branch)
* If invoked from a release, including an rc, it is tagged with the release tag
* If invoked manually on a branch, it is tagged with the branch name

**NOTE:** To avoid surprising users, there is no `latest` tag generated.
1 change: 1 addition & 0 deletions e2e.Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Info on how to use this docker image can be found in DOCKER_README.md
ARG IMG_TAG=latest

# Compile the gaiad binary
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ endif
.PHONY: run-tests $(TEST_TARGETS)

docker-build-debug:
@docker build -t cosmos/gaiad-e2e -f e2e.Dockerfile .
@docker build -t cosmos/gaiad-e2e -f Dockerfile .

# TODO: Push this to the Cosmos Dockerhub so we don't have to keep building it
# in CI.
Expand Down

0 comments on commit 1e6e363

Please sign in to comment.