ai-code-battle/starters/go/Dockerfile
jedarden 7694723758 feat(starter-go): implement Go starter kit with shared game package
Complete Go starter kit for AI Code Battle with:

- main.go: HTTP server with HMAC authentication, placeholder computeMoves()
- game/ package: Shared utilities (types, auth, grid) for reuse
  - types.go: Game state types, Direction constants, Position, etc.
  - auth.go: HMAC-SHA256 signing/verification with timestamp validation
  - grid.go: Toroidal distance, BFS pathfinding, neighbor functions
- Tests: Comprehensive test coverage for grid and auth utilities
- Dockerfile: Multi-stage build with Go 1.24-alpine
- README: Complete documentation with examples and protocol reference

The starter kit provides a minimal working bot that holds position
by default. Participants implement their strategy in computeMoves()
using the provided grid utilities.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-08 10:10:51 -04:00

31 lines
456 B
Docker

FROM golang:1.24-alpine AS builder
WORKDIR /app
# Copy go.mod and download dependencies
COPY go.mod .
RUN go mod download
# Copy source files
COPY main.go .
COPY game/ ./game/
# Build the bot
RUN CGO_ENABLED=0 go build -o bot .
FROM alpine:3.21
WORKDIR /app
# Copy the binary from builder
COPY --from=builder /app/bot .
# Set environment variables
ENV BOT_PORT=8080
ENV BOT_SECRET=""
# Expose the bot port
EXPOSE 8080
# Run the bot
CMD ["./bot"]