Skip to content

Commit

Permalink
fix: findNodes err and add build images ci
Browse files Browse the repository at this point in the history
  • Loading branch information
fearlessfe authored and GrapeBaBa committed Dec 8, 2024
1 parent cc85bf6 commit 48cb84a
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 9 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: shisui latest image

on:
push:
branches: [main]

defaults:
run:
shell: bash

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: write

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
push_image_to_github:
name: Push Docker image to Github
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Check out the repo
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile.portal
push: true
tags: ${{ env.REGISTRY }}/${{ github.repository }}:latest
7 changes: 3 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
FROM --platform=linux/amd64 golang:1.23 as builder
FROM golang:1.23 as builder

WORKDIR /app

COPY . .
RUN go env -w GOPROXY=https://goproxy.cn,direct
# RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build ./cmd/shisui/main.go

RUN make shisui


FROM --platform=linux/amd64 ubuntu:22.04
FROM ubuntu:22.04

COPY --from=builder /app/build/bin/shisui /usr/local/bin/app

Expand Down
11 changes: 6 additions & 5 deletions portalwire/portal_protocol.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,11 @@ func (p *PortalProtocol) setupDiscV5AndTable() error {
}

cfg := discover.Config{
PrivateKey: p.PrivateKey,
NetRestrict: p.NetRestrict,
Bootnodes: p.BootstrapNodes,
Log: p.Log,
PrivateKey: p.PrivateKey,
NetRestrict: p.NetRestrict,
Bootnodes: p.BootstrapNodes,
Log: p.Log,
NoFindnodeLivenessCheck: true,
}

p.table, err = discover.NewTable(p, p.localNode.Database(), cfg)
Expand Down Expand Up @@ -970,7 +971,7 @@ func (p *PortalProtocol) handleFindNodes(fromAddr *net.UDPAddr, request *FindNod
enrs := p.truncateNodes(nodes, maxPayloadSize, enrOverhead)

nodesMsg := &Nodes{
Total: 1,
Total: uint8(len(enrs)),
Enrs: enrs,
}

Expand Down

0 comments on commit 48cb84a

Please sign in to comment.