35 lines
1.1 KiB
Docker
35 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 and source
|
|
COPY go-modules/go.mod go-modules/go.sum* ./
|
|
COPY go-modules/*.go ./
|
|
|
|
# Generate go.sum and download dependencies
|
|
RUN go mod tidy
|
|
|
|
# Build the plugin as a shared library
|
|
RUN go build -buildmode=plugin -trimpath -o backend.so .
|
|
|
|
# Verify build exists
|
|
RUN ls -la 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
|