Files
tic-tac-toe/Dockerfile
Vishesh 'ironeagle' Bangotra 73e3f0a7ac
Some checks failed
continuous-integration/drone/tag Build is failing
fixes
2025-11-29 18:38:13 +05:30

37 lines
1.1 KiB
Docker

# -----------------------------------------------------
# 1. Build the Nakama plugin (ARM64)
# -----------------------------------------------------
FROM golang:1.22-alpine AS plugin_builder
# Install dependencies needed for CGO plugin build
RUN apk add --no-cache git build-base
WORKDIR /workspace
# Download module deps first (better caching)
COPY go.mod go.sum ./
RUN go mod download
# Copy source code
COPY . .
# Build plugin
RUN mkdir -p build && \
CGO_ENABLED=1 go build \
--trimpath \
--buildmode=plugin \
-o build/main.so \
./plugins
# -----------------------------------------------------
# 2. Build final Nakama image (ARM64)
# -----------------------------------------------------
FROM --platform=linux/arm64 heroiclabs/nakama:3.21.0 AS nakama
# Copy plugin from builder stage
COPY --from=plugin_builder /workspace/build/main.so /nakama/data/modules/main.so
# Default Nakama startup (runs migrations + server)
ENTRYPOINT exec /bin/sh -ecx "/nakama/nakama migrate up --database.address \"$DB_ADDR\" && exec /nakama/nakama --database.address \"$DB_ADDR\" --socket.server_key=\"$SERVER_KEY\""