From fdb30c71690916da612d795e0eb873b954ed8db5 Mon Sep 17 00:00:00 2001 From: Bhavnoor Singh Saroya Date: Mon, 18 Aug 2025 23:24:53 -0700 Subject: [PATCH 1/3] deprecate shitty design choices --- board/api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/board/api.go b/board/api.go index 38c889a..db2200b 100644 --- a/board/api.go +++ b/board/api.go @@ -4,6 +4,8 @@ import ( "github.com/BattlesnakeOfficial/rules" ) +// This is deprecated now because of db writes + caching + // Types used to implement the JSON API expected by the board client. // JSON structure returned by the game status endpoint. From e37b0a9329439b0e7230b4aef5685da8f25ced49 Mon Sep 17 00:00:00 2001 From: Bhavnoor Singh Saroya Date: Mon, 18 Aug 2025 23:25:19 -0700 Subject: [PATCH 2/3] bugfix set port number --- cli/commands/play.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cli/commands/play.go b/cli/commands/play.go index f43007f..4000214 100644 --- a/cli/commands/play.go +++ b/cli/commands/play.go @@ -256,6 +256,7 @@ func NewHostCommand() *cobra.Command { }(gameState) w.Header().Set("Content-Type", "application/json") + w.Header().Set("Access-Control-Allow-Origin", "*") // Allow CORS for all origins w.WriteHeader(http.StatusOK) resp := map[string]string{ @@ -265,8 +266,8 @@ func NewHostCommand() *cobra.Command { json.NewEncoder(w).Encode(resp) }) - log.INFO.Print("Hosting Battlesnake HTTP server on :6969") - log.INFO.Print(http.ListenAndServe(":6969", nil)) + log.INFO.Print("Hosting Battlesnake HTTP server on :8080") + log.INFO.Print(http.ListenAndServe(":8080", nil)) }, } From 3e8a4b8f870835f348efb12e19e6976723f5e2d4 Mon Sep 17 00:00:00 2001 From: Bhavnoor Singh Saroya Date: Mon, 18 Aug 2025 23:26:09 -0700 Subject: [PATCH 3/3] add dockerfile for deployment streamlined with alpine --- Dockerfile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..556e680 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +ARG GO_VERSION=1 +FROM golang:${GO_VERSION}-alpine as builder + +WORKDIR /usr/src/app +COPY go.mod go.sum ./ +RUN go mod download && go mod verify +COPY . . +RUN go build -v -o /run-app ./cli/battlesnake/main.go + + +FROM alpine:latest + +COPY --from=builder /run-app /usr/local/bin/ +CMD ["run-app", "host"]