Skip to content

Commit

Permalink
Release v0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
gitferry authored Feb 8, 2024
2 parents 8caa336 + dbfe363 commit fb1d6f2
Show file tree
Hide file tree
Showing 132 changed files with 12,895 additions and 10,428 deletions.
15 changes: 6 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,13 @@ jobs:
resource_class: large
steps:
- go/install:
version: "1.20"
version: "1.21.4"
- checkout
- run:
name: Print Go environment
command: "go env"
- go/load-cache:
key: go-mod-v6-{{ checksum "go.sum" }}
- add_ssh_keys
- go/mod-download
- go/save-cache:
key: go-mod-v6-{{ checksum "go.sum" }}
Expand All @@ -29,8 +28,8 @@ jobs:
- run:
name: Lint
command: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.52.2
./bin/golangci-lint run
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2
./bin/golangci-lint run --timeout 5m0s
- run:
name: Run tests
command: |
Expand All @@ -46,23 +45,21 @@ jobs:
resource_class: large
steps:
- checkout
- add_ssh_keys
- aws-ecr/build-image:
push-image: false
dockerfile: Dockerfile
path: ./
build-path: ./
tag: "$CIRCLE_SHA1,$CIRCLE_TAG"
repo: "$CIRCLE_PROJECT_REPONAME"
extra-build-args: "--secret id=sshKey,src=/home/circleci/.ssh/$DEPLOY_KEY_NAME"
- run:
name: Save Docker image to export it to workspace
command: |
docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/btcvalidator.tar
docker save $(docker image ls --format '{{.Repository}}:{{.Tag}}') > /tmp/finality-provider.tar
- persist_to_workspace:
root: /tmp
paths:
- btcvalidator.tar
- finality-provider.tar

push_docker:
machine:
Expand All @@ -74,7 +71,7 @@ jobs:
- run:
name: Load Docker image from workspace
command: |
docker load -i /tmp/btcvalidator.tar
docker load -i /tmp/finality-provider.tar
- aws-ecr/ecr-login:
aws-access-key-id: AWS_ACCESS_KEY_ID
aws-secret-access-key: AWS_SECRET_ACCESS_KEY
Expand Down
31 changes: 12 additions & 19 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.20.5-alpine as builder
FROM golang:1.21.4-alpine as builder

# Version to build. Default is the Git HEAD.
ARG VERSION="HEAD"
Expand All @@ -12,17 +12,13 @@ RUN apk add --no-cache --update openssh git make build-base linux-headers libc-d
libzmq-static libsodium-static gcc


RUN mkdir -p /root/.ssh && ssh-keyscan github.com >> /root/.ssh/known_hosts
RUN git config --global url."[email protected]:".insteadOf "https://github.com/"
ENV GOPRIVATE=github.com/babylonchain/babylon-private

# Build
WORKDIR /go/src/github.com/babylonchain/btc-validator
WORKDIR /go/src/github.com/babylonchain/finality-provider
# Cache dependencies
COPY go.mod go.sum /go/src/github.com/babylonchain/btc-validator/
RUN --mount=type=secret,id=sshKey,target=/root/.ssh/id_rsa go mod download
COPY go.mod go.sum /go/src/github.com/babylonchain/finality-provider/
RUN go mod download
# Copy the rest of the files
COPY ./ /go/src/github.com/babylonchain/btc-validator/
COPY ./ /go/src/github.com/babylonchain/finality-provider/

# Cosmwasm - Download correct libwasmvm version
RUN WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm | cut -d ' ' -f 2) && \
Expand All @@ -41,17 +37,14 @@ RUN CGO_LDFLAGS="$CGO_LDFLAGS -lstdc++ -lm -lsodium" \
# FINAL IMAGE
FROM alpine:3.16 AS run

RUN addgroup --gid 1138 -S btcvalidator && adduser --uid 1138 -S btcvalidator -G btcvalidator
RUN addgroup --gid 1138 -S finality-provider && adduser --uid 1138 -S finality-provider -G finality-provider

RUN apk add bash curl jq

COPY --from=builder /go/src/github.com/babylonchain/btc-validator/build/vald /bin/vald
COPY --from=builder /go/src/github.com/babylonchain/btc-validator/build/valcli /bin/valcli

WORKDIR /home/btcvalidator
RUN chown -R btcvalidator /home/btcvalidator
USER btcvalidator
COPY --from=builder /go/src/github.com/babylonchain/finality-provider/build/fpd /bin/fpd
COPY --from=builder /go/src/github.com/babylonchain/finality-provider/build/fpcli /bin/fpcli
COPY --from=builder /go/src/github.com/babylonchain/finality-provider/build/eotsd /bin/eotsd

ENTRYPOINT ["/bin/vald"]
CMD []
STOPSIGNAL SIGTERM
WORKDIR /home/finality-provider
RUN chown -R finality-provider /home/finality-provider
USER finality-provider
Loading

0 comments on commit fb1d6f2

Please sign in to comment.