Merge branch 'release_image' into 'v1.4.19'

create docker image based on release binaries

See merge request quilibrium/ceremonyclient!4
This commit is contained in:
Cassie Heart 2024-06-07 00:50:15 +00:00
commit 0cbc0d0d31
6 changed files with 97 additions and 23 deletions

View File

@ -6,9 +6,9 @@ The only requirements are `git` (to checkout the repository) and docker (to buil
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:
In the repository root folder, where the [Dockerfile.source](Dockerfile.source) 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 .
docker build -f Dockerfile.source --build-arg GIT_COMMIT=$(git log -1 --format=%h) -t quilibrium -t quilibrium:1.4.16 .
```
Use latest version instead of `1.4.16`.

55
Dockerfile.release Normal file
View File

@ -0,0 +1,55 @@
FROM golang:1.20.14-alpine3.19 as build
ARG NODE_VERSION
ARG MAX_KEY_ID
ENV GOEXPERIMENT=arenas
WORKDIR /opt/ceremonyclient
COPY . .
RUN cp "node/node-${NODE_VERSION}-linux-amd64" "node/node"
RUN cp "node/node-${NODE_VERSION}-linux-amd64.dgst" "node/node.dgst"
RUN for i in $(seq 1 ${MAX_KEY_ID}); do \
if [ -f node/node-${NODE_VERSION}-linux-amd64.dgst.sig.${i} ]; then \
cp "node/node-${NODE_VERSION}-linux-amd64.dgst.sig.${i}" "node/node.dgst.sig.${i}"; \
fi \
done
WORKDIR /opt/ceremonyclient/client
RUN go build -o qclient ./main.go
RUN go install github.com/fullstorydev/grpcurl/cmd/grpcurl@v1.9.1
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 /opt/ceremonyclient/node/node /usr/local/bin
COPY --from=build /opt/ceremonyclient/node/node.dgst /usr/local/bin
COPY --from=build /opt/ceremonyclient/node/node.dgst.sig.* /usr/local/bin
COPY --from=build /opt/ceremonyclient/client/qclient /usr/local/bin
COPY --from=build /go/bin/grpcurl /usr/local/bin
WORKDIR /root
ENTRYPOINT ["node"]

View File

@ -5,6 +5,9 @@ version: '3'
dotenv:
- '.env'
env:
DOCKER_BUILDKIT: '1'
vars:
VERSION:
sh: cat node/config/version.go | grep -A 1 "func GetVersion() \[\]byte {" | grep -Eo '0x[0-9a-fA-F]+' | xargs printf "%d.%d.%d"
@ -14,6 +17,7 @@ vars:
sh: git rev-parse --abbrev-ref HEAD
GIT_COMMIT:
sh: git log -1 --format=%h
MAX_KEY_ID: 17
tasks:
status:
@ -24,33 +28,54 @@ tasks:
- echo -n "Repo :" && echo " {{.GIT_REPO}}"
- echo -n "Branch :" && echo " {{.GIT_BRANCH}}"
- echo -n "Commit :" && echo " {{.GIT_COMMIT}}"
- echo -n "Max Key ID:" && echo " {{.MAX_KEY_ID}}"
silent: true
build:
desc: Build the Quilibrium docker image, unless it is already built.
build:source:
desc: Build the Quilibrium docker image from source.
cmds:
- |
docker build \
-f Dockerfile.source \
--build-arg NODE_VERSION={{.VERSION}} \
--build-arg GIT_REPO={{.GIT_REPO}} \
--build-arg GIT_BRANCH={{.GIT_BRANCH}} \
--build-arg GIT_COMMIT={{.GIT_COMMIT}} \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}} \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:latest \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-source \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:source \
.
status:
- |
docker image inspect \
${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}} \
${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-source \
>/dev/null 2>/dev/null
github:login:
desc: Login to GitHub container registry.
build:release:
desc: Build the Quilibrium docker image from release binaries.
aliases:
- build
cmds:
- echo $GITHUB_TOKEN | docker login ghcr.io -u $GITHUB_USERNAME --password-stdin
- |
docker build \
-f Dockerfile.release \
--build-arg NODE_VERSION={{.VERSION}} \
--build-arg GIT_REPO={{.GIT_REPO}} \
--build-arg GIT_BRANCH={{.GIT_BRANCH}} \
--build-arg GIT_COMMIT={{.GIT_COMMIT}} \
--build-arg MAX_KEY_ID={{.MAX_KEY_ID}} \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-release \
-t ${QUILIBRIUM_IMAGE_NAME:-quilibrium}:release \
.
status:
- |
docker image inspect \
${QUILIBRIUM_IMAGE_NAME:-quilibrium}:{{.VERSION}}-release \
>/dev/null 2>/dev/null
docker:login:
desc: Login to Docker hub
aliases:
- login
cmds:
- echo $DOCKER_TOKEN | docker login -u $DOCKER_USERNAME --password-stdin

View File

@ -7,13 +7,6 @@ services:
node:
image: ${QUILIBRIUM_IMAGE_NAME:-quilibrium}
restart: unless-stopped
deploy:
resources:
limits:
memory: '32G'
reservations:
cpus: '12'
memory: '16G'
environment:
- DEFAULT_LISTEN_GRPC_MULTIADDR=/ip4/0.0.0.0/tcp/8337
- DEFAULT_LISTEN_REST_MULTIADDR=/ip4/0.0.0.0/tcp/8338
@ -27,7 +20,7 @@ services:
interval: 30s
timeout: 5s
retries: 3
start_period: 1m
start_period: 15m
volumes:
- ./.config:/root/.config
logging:

View File

@ -11,7 +11,7 @@ env:
vars:
VERSION:
sh: cat ../node/config/version.go | grep -A 1 "func GetVersion() \[\]byte {" | grep -Eo '0x[0-9a-fA-F]+' | xargs printf "%d.%d.%d"
MAX_KEY_ID: 15
MAX_KEY_ID: 17
QUILIBRIUM_SIGNERS_IMAGE_NAME: 'quilibrium-signers'
USER_NAME:
sh: whoami
@ -27,6 +27,7 @@ tasks:
- echo -n "Priv Key Path:" && echo " {{.SIGNING_KEY_PATH}}"
- echo -n "Pub Key Path:" && echo " {{.SIGNING_PUB_KEY_PATH}}"
- echo -n "Key ID :" && echo " {{.SIGNING_KEY_ID}}"
- echo -n "Max Key ID :" && echo " {{.MAX_KEY_ID}}"
silent: true
hex: