diff --git a/.goreleaser.yml b/.goreleaser.yml index 2b4e4d2a..efbd2059 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -28,6 +28,34 @@ builds: ignore: - goos: darwin goarch: amd64 + - id: signature-aggregator + main: ./signature-aggregator/main/main.go + binary: signature-aggregator + flags: + - -v + # windows is ignored by default, as the `goos` field by default only + # contains linux and darwin + goos: + - linux + - darwin + goarch: + - amd64 + - arm64 + env: + - CGO_ENABLED=1 + - CGO_CFLAGS=-O -D__BLST_PORTABLE__ # Set the CGO flags to use the portable version of BLST + overrides: + - goos: linux + goarch: arm64 + env: + - CC=aarch64-linux-gnu-gcc + - goos: darwin + goarch: arm64 + env: + - CC=oa64-clang + ignore: + - goos: darwin + goarch: amd64 dockers: - image_templates: - 'avaplatform/awm-relayer:{{ .Tag }}-amd64' @@ -35,14 +63,29 @@ dockers: build_flag_templates: - "--pull" - "--platform=linux/amd64" - - "--build-arg=GO_VERSION={{ .Env.GO_VERSION }}" + dockerfile: "relayer/Dockerfile" - image_templates: - 'avaplatform/awm-relayer:{{ .Tag }}-arm64' use: buildx build_flag_templates: - "--pull" - "--platform=linux/arm64" - - "--build-arg=GO_VERSION={{ .Env.GO_VERSION }}" + dockerfile: "relayer/Dockerfile" + goarch: arm64 + - image_templates: + - 'avaplatform/signature-aggregator:{{ .Tag }}-amd64' + use: buildx + build_flag_templates: + - "--pull" + - "--platform=linux/amd64" + dockerfile: "signature-aggregator/Dockerfile" + - image_templates: + - 'avaplatform/signature-aggregator:{{ .Tag }}-arm64' + use: buildx + build_flag_templates: + - "--pull" + - "--platform=linux/arm64" + dockerfile: "signature-aggregator/Dockerfile" goarch: arm64 docker_manifests: - name_template: 'avaplatform/awm-relayer:{{ .Tag }}' @@ -55,6 +98,16 @@ docker_manifests: - 'avaplatform/awm-relayer:{{ .Tag }}-arm64' # If tag is an rc, do not push the latest tag skip_push: auto + - name_template: 'avaplatform/signature-aggregator:{{ .Tag }}' + image_templates: + - 'avaplatform/signature-aggregator:{{ .Tag }}-amd64' + - 'avaplatform/signature-aggregator:{{ .Tag }}-arm64' + - name_template: 'avaplatform/signature-aggregator:latest' + image_templates: + - 'avaplatform/signature-aggregator:{{ .Tag }}-amd64' + - 'avaplatform/signature-aggregator:{{ .Tag }}-arm64' + # If tag is an rc, do not push the latest tag + skip_push: auto release: # Repo in which the release will be created. # Default is extracted from the origin remote URL or empty if its private hosted. @@ -62,4 +115,4 @@ release: owner: ava-labs name: awm-relayer # If tag indicates rc, will mark it as prerelease - prerelease: auto \ No newline at end of file + prerelease: auto diff --git a/Dockerfile b/Dockerfile deleted file mode 100644 index 713622c2..00000000 --- a/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -ARG GO_VERSION -FROM golang:${GO_VERSION} -COPY awm-relayer /usr/bin/awm-relayer -EXPOSE 8080 -USER 1001 -CMD ["start"] -ENTRYPOINT [ "/usr/bin/awm-relayer" ] \ No newline at end of file diff --git a/relayer/Dockerfile b/relayer/Dockerfile new file mode 100644 index 00000000..87461e5f --- /dev/null +++ b/relayer/Dockerfile @@ -0,0 +1,6 @@ +FROM debian:11-slim +COPY awm-relayer /usr/bin/awm-relayer +EXPOSE 8080 +USER 1001 +CMD ["start"] +ENTRYPOINT [ "/usr/bin/awm-relayer" ] diff --git a/scripts/build_signature_aggregator_image.sh b/scripts/build_signature_aggregator_image.sh new file mode 100755 index 00000000..5ab7b9cb --- /dev/null +++ b/scripts/build_signature_aggregator_image.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +# Use this script to build the approver docker image in your local working copy +# of the repository. Be prepared to repeatedly hit your YubiKey during the `go +# mod download` step of the image build, just like you need to do for a +# non-Docker build. + +set -o errexit +set -o nounset +set -o xtrace + +REPO_PATH=$(git rev-parse --show-toplevel) +source "$REPO_PATH/scripts/versions.sh" +source "$REPO_PATH/scripts/constants.sh" + +docker_repo=avaplatform/signature-aggregator + +docker --debug build \ + --build-arg="GO_VERSION=${GO_VERSION}" \ + --build-arg="API_PORT=${SIGNATURE_AGGREGATOR_API_PORT}" \ + --build-arg="METRICS_PORT=${SIGNATURE_AGGREGATOR_METRICS_PORT}" \ + --file "$REPO_PATH/signature-aggregator/Dockerfile" \ + --ssh default \ + --tag "${docker_repo}:$(git rev-parse HEAD)" \ + --tag "${docker_repo}:$(git rev-parse --abbrev-ref HEAD | sed 's/\//-/g')" \ + . diff --git a/scripts/constants.sh b/scripts/constants.sh index 752f2d18..8c20b772 100755 --- a/scripts/constants.sh +++ b/scripts/constants.sh @@ -24,6 +24,11 @@ SIGNATURE_AGGREGATOR_PATH=$( relayer_path="$BASE_PATH/build/awm-relayer" signature_aggregator_path="$BASE_PATH/build/signature-aggregator" +# these are duplicated here from signature-aggregator/config so they can be +# used as arguments to the docker image build. +export SIGNATURE_AGGREGATOR_API_PORT=8080 +export SIGNATURE_AGGREGATOR_METRICS_PORT=8081 + # Set the PATHS GOPATH="$(go env GOPATH)" diff --git a/signature-aggregator/Dockerfile b/signature-aggregator/Dockerfile new file mode 100644 index 00000000..891fdebb --- /dev/null +++ b/signature-aggregator/Dockerfile @@ -0,0 +1,6 @@ +FROM debian:11-slim +COPY signature-aggregator /usr/bin/signature-aggregator +EXPOSE 8080 +EXPOSE 8081 +CMD ["start"] +ENTRYPOINT [ "/usr/bin/signature-aggregator" ]