Compare commits

..

3 commits

Author SHA1 Message Date
3e8a4b8f87 add dockerfile for deployment
Some checks are pending
Test / Format (gofmt) (push) Waiting to run
Test / Lint (golangci-lint) (push) Waiting to run
Test / Test (go test) (push) Blocked by required conditions
Test / Build CLI (go install) (push) Blocked by required conditions
streamlined with alpine
2025-08-18 23:26:09 -07:00
e37b0a9329 bugfix set port number 2025-08-18 23:25:19 -07:00
fdb30c7169 deprecate shitty design choices 2025-08-18 23:24:53 -07:00
3 changed files with 19 additions and 2 deletions

14
Dockerfile Normal file
View file

@ -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"]

View file

@ -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.

View file

@ -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))
},
}