Skip to content

Commit

Permalink
feat: update docker
Browse files Browse the repository at this point in the history
  • Loading branch information
boodyvo committed Sep 23, 2024
1 parent e6750af commit 28eb680
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 192 deletions.
8 changes: 5 additions & 3 deletions alerts/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
FROM golang:1.20-bullseye as build-env
FROM golang:1.21.9-bullseye AS build-env

ADD . /src
RUN cd /src && go build -o /alerts
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg/mod \
cd /src && go build -o /alerts

FROM debian:bullseye

RUN apt-get update \
&& apt-get install -y ca-certificates \
&& apt-get install -y curl ca-certificates \
&& rm -rf /var/lib/apt/lists/* \
&& update-ca-certificates

Expand Down
180 changes: 0 additions & 180 deletions alerts/auctions/client.go

This file was deleted.

10 changes: 10 additions & 0 deletions alerts/auctions/grpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,16 @@ import (
"google.golang.org/grpc"
)

const (
DefaultPageLimit = 1000
)

// InfoResponse defines the ID and latest height for a specific chain
type InfoResponse struct {
ChainId string `json:"chain_id" yaml:"chain_id"`
LatestHeight int64 `json:"latest_height" yaml:"latest_height"`
}

// AuctionClient defines the expected client interface for interacting with auctions
type AuctionClient interface {
GetInfo() (*InfoResponse, error)
Expand Down
13 changes: 4 additions & 9 deletions alerts/cmd/auctions.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"fmt"
kavagrpc "github.com/kava-labs/kava/client/grpc"
"os"
"strings"
"time"
Expand All @@ -14,6 +13,7 @@ import (
"github.com/kava-labs/go-tools/alerts/config"
"github.com/kava-labs/go-tools/alerts/persistence"
kava "github.com/kava-labs/kava/app"
kavagrpc "github.com/kava-labs/kava/client/grpc"
"github.com/spf13/cobra"
)

Expand Down Expand Up @@ -69,24 +69,19 @@ var runAuctionsCmd = &cobra.Command{
"AlertFrequency", config.AlertFrequency.String(),
).Info("config loaded")

// Bootstrap rpc http clent
//http, err := rpchttpclient.New(config.GrpcConfig, "/websocket")
//if err != nil {
// return err
//}
//http.Logger = logger

// Create codec for messages
encodingConfig := kava.MakeEncodingConfig()

// Bootstrap grpc http client

grpcClient, err := kavagrpc.NewClient(config.KavaGrpcUrl)
if err != nil {
return fmt.Errorf("failed to create grpc client: %v", err)
}

// Create rpc client for fetching data
logger.Info("creating rpc client")
auctionClient := auctions.NewGrpcAuctionClient(grpcClient, *encodingConfig.Amino)
auctionClient := auctions.NewGrpcAuctionClient(grpcClient, encodingConfig.Marshaler)

firstIteration := true

Expand Down

0 comments on commit 28eb680

Please sign in to comment.