2026-01-06 05:13:49 -05:00
|
|
|
# =============================================================================
|
2026-01-08 00:52:34 -05:00
|
|
|
# Nakama with Custom Go Chess Modules
|
2026-01-06 05:13:49 -05:00
|
|
|
# =============================================================================
|
|
|
|
|
# Two-stage build:
|
2026-01-08 00:52:34 -05:00
|
|
|
# 1. Build Go plugin using official Nakama plugin builder
|
|
|
|
|
# 2. Copy compiled plugin to Nakama runtime
|
2026-01-06 05:13:49 -05:00
|
|
|
# =============================================================================
|
|
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Stage 1: Build Go plugin
|
|
|
|
|
# IMPORTANT: Plugin builder version MUST match Nakama server version
|
|
|
|
|
FROM heroiclabs/nakama-pluginbuilder:3.35.1 AS builder
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
WORKDIR /backend
|
2026-01-06 05:19:07 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Copy Go module files
|
|
|
|
|
COPY go-modules/go.mod go-modules/go.sum* ./
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Download dependencies
|
|
|
|
|
RUN go mod download 2>/dev/null || go mod tidy
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Copy source
|
|
|
|
|
COPY go-modules/*.go ./
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Build the plugin as a shared library
|
|
|
|
|
RUN go build -buildmode=plugin -trimpath -o backend.so .
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Verify build
|
|
|
|
|
RUN ls -la backend.so && file backend.so
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Stage 2: Nakama runtime with Go plugin
|
2026-01-07 22:20:16 -05:00
|
|
|
FROM registry.heroiclabs.com/heroiclabs/nakama:3.35.1
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Copy compiled Go plugin
|
|
|
|
|
COPY --from=builder /backend/backend.so /nakama/data/modules/backend.so
|
2026-01-06 05:13:49 -05:00
|
|
|
|
2026-01-08 00:52:34 -05:00
|
|
|
# Copy config file
|
2026-01-06 05:13:49 -05:00
|
|
|
COPY config.yml /nakama/data/config.yml
|