added dockerfile for nakama
This commit is contained in:
44
Dockerfile
Normal file
44
Dockerfile
Normal file
@@ -0,0 +1,44 @@
|
||||
# -----------------------------------------------------
|
||||
# 1. Build the Nakama plugin (ARM64)
|
||||
# -----------------------------------------------------
|
||||
FROM --platform=linux/arm64 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
|
||||
|
||||
# Copy Nakama config
|
||||
COPY local.yml /nakama/data/local.yml
|
||||
|
||||
# Default Nakama startup (runs migrations + server)
|
||||
ENTRYPOINT [
|
||||
"/bin/sh",
|
||||
"-ecx",
|
||||
"/nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama?sslmode=disable && \
|
||||
exec /nakama/nakama --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama?sslmode=disable"
|
||||
]
|
||||
Reference in New Issue
Block a user