37 lines
1.1 KiB
Docker
37 lines
1.1 KiB
Docker
# =============================================================================
|
|
# Nakama with Custom Go Chess Modules
|
|
# =============================================================================
|
|
# Two-stage build:
|
|
# 1. Build Go plugin using official Nakama plugin builder
|
|
# 2. Copy compiled plugin to Nakama runtime
|
|
# =============================================================================
|
|
|
|
# Stage 1: Build Go plugin
|
|
# IMPORTANT: Plugin builder version MUST match Nakama server version
|
|
FROM heroiclabs/nakama-pluginbuilder:3.35.1 AS builder
|
|
|
|
WORKDIR /backend
|
|
|
|
# Copy Go module files
|
|
COPY go-modules/go.mod go-modules/go.sum* ./
|
|
|
|
# Download dependencies
|
|
RUN go mod download 2>/dev/null || go mod tidy
|
|
|
|
# Copy source
|
|
COPY go-modules/*.go ./
|
|
|
|
# Build the plugin as a shared library
|
|
RUN go build -buildmode=plugin -trimpath -o backend.so .
|
|
|
|
# Verify build
|
|
RUN ls -la backend.so && file backend.so
|
|
|
|
# Stage 2: Nakama runtime with Go plugin
|
|
FROM registry.heroiclabs.com/heroiclabs/nakama:3.35.1
|
|
|
|
# Copy compiled Go plugin
|
|
COPY --from=builder /backend/backend.so /nakama/data/modules/backend.so
|
|
|
|
# Copy config file
|
|
COPY config.yml /nakama/data/config.yml
|