Skip to content

Commit

Permalink
add v1.4.18-p1
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhi committed May 30, 2024
0 parents commit 4a2a0af
Show file tree
Hide file tree
Showing 2,171 changed files with 981,994 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
.config*
**/.idea
**/.vscode
github.env
Taskfile.yaml

3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Use a custom docker image name
# Default: quilibrium
QUILIBRIUM_IMAGE_NAME=
47 changes: 47 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Docker Image CI

on:
push:
branches: [ "main" ]
tags: [ 'v*.*.*' ]
pull_request:
branches: [ "main" ]

env:
REGISTRY: ghcr.io
IMAGE_NAME: ghcr.io/${{ github.actor }}/quilibrium

jobs:

build:

runs-on: ubuntu-latest

steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Set the value
run: |
echo "git_tag=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1))" >> "$GITHUB_ENV"
- name: Use the value
run: |
printf '%s\n' "$git_tag"
- name: Docker login
uses: docker/[email protected]
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the Docker image
run: |
docker build \
--build-arg GIT_COMMIT=$(git log -1 --format=%h) \
--build-arg GIT_REPO=$(git config --get remote.origin.url | sed 's/\.git$//') \
--build-arg GIT_BRANCH=$(git rev-parse --abbrev-ref HEAD) \
--build-arg NODE_VERSION=$git_tag \
-t ${{ env.IMAGE_NAME }}:$git_tag \
--no-cache \
.
- name: Docker image push
run: docker push ${{ env.IMAGE_NAME }}:$git_tag
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.idea/
vouchers/
ceremony-client
.config*
.DS_Store
*.mprof
.env
.env.signers
.task
node-tmp-*
53 changes: 53 additions & 0 deletions DOCKER-README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Quilibrium Docker Instructions

## Build

The only requirements are `git` (to checkout the repository) and docker (to build the image).
Golang does not have to be installed, the docker image build process uses a build stage that provides the
correct Go environment and compiles the node down to one command.

In the repository root folder, where the [Dockerfile](Dockerfile) file is, build the docker image:
```shell
docker build --build-arg GIT_COMMIT=$(git log -1 --format=%h) -t quilibrium -t quilibrium:1.4.16 .
```

Use latest version instead of `1.4.16`.

The image that is built is light and safe. It is based on Alpine Linux with the Quilibrium node binary, no
source code, nor the Go development environment. The image also has the `grpcurl` tool that can be used to
query the gRPC interface.

### Task

You can also use the [Task](https://taskfile.dev/) tool, it is a simple build tool that takes care of extracting
parameters and building the image. The tasks are all defined in [Taskfile.yaml](Taskfile.yaml).

You can optionally create an `.env` file, in the same repository root folder to override specific parameters. Right now
only one optional env var is supported and that is `QUILIBRIUM_IMAGE_NAME`, if you want to change the default
image name from `quilibrium` to something else. If you are pushing your images to GitHub then you have to follow the
GitHub naming convention and use a name like `ghcr.io/mscurtescu/ceremonyclient`.

Bellow there are example interactions with `Task`.

The node version is extracted from [node/main.go](node/main.go). This version string is used to tag the image. The git
repo, branch and commit are read through the `git` command and depend on the current state of your working
directory (on what branch and at what commit you are). These last three values are used to label the image.

List tasks:
```shell
task -l
```

Show what parameters, like image name, version etc, will be used:
```shell
task status
```

Build the image (aka run the `build` task):
```shell
task build
```

## Run

In order to run a Quilibrium node using the docker image follow the instructions in the [docker](docker) subfolder.
43 changes: 43 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
FROM golang:1.20.14-alpine3.19 as build

ENV GOEXPERIMENT=arenas

WORKDIR /opt/ceremonyclient

COPY . .

WORKDIR /opt/ceremonyclient/node

RUN go install ./...
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@latest

WORKDIR /opt/ceremonyclient/client

RUN go build -o qclient ./main.go

FROM alpine:3.19

ARG NODE_VERSION
ARG GIT_REPO
ARG GIT_BRANCH
ARG GIT_COMMIT

ENV GOEXPERIMENT=arenas

LABEL org.opencontainers.image.title="Quilibrium Network Node"
LABEL org.opencontainers.image.description="Quilibrium is a decentralized alternative to platform as a service providers."
LABEL org.opencontainers.image.version=$NODE_VERSION
LABEL org.opencontainers.image.vendor=Quilibrium
LABEL org.opencontainers.image.url=https://quilibrium.com/
LABEL org.opencontainers.image.documentation=https://quilibrium.com/docs
LABEL org.opencontainers.image.source=$GIT_REPO
LABEL org.opencontainers.image.ref.name=$GIT_BRANCH
LABEL org.opencontainers.image.revision=$GIT_COMMIT

COPY --from=build /go/bin/node /usr/local/bin
COPY --from=build /go/bin/grpcurl /usr/local/bin
COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin

WORKDIR /root

ENTRYPOINT ["node"]
Loading

0 comments on commit 4a2a0af

Please sign in to comment.