having similar issue with this Nakama/Docker Path Issues, although im not quite sure whats the directory looks like, mine is like this:
basically im getting this error when running docker compose up
:
{"level":"fatal","ts":"2023-07-19T01:55:05.678Z","caller":"server/config.go:306","msg":"JavaScript entrypoint must be a valid path","error":"stat data/modules/build/index.js: no such file or directory"}
.
├── build/
├── data/
│ ├── modules/
│ └── .cookie [RO]
│ └── logfile.log
│ └── my-config.yml
├── node_modules/
│ ├── nakama-runtime/
│ └── typescript/
├── docker-compose.yml
├── Dockerfile
├── package-lock.json
├── package.json
├── src/
└── tsconfig.json
my-config.yml
name: nakama-node-1
data_dir: "./data"
logger:
stdout: true
level: "warn"
file: "/nakama/data/logfile.log"
runtime:
js_entrypoint: "build/index.js"
console:
port: 7351
username: "root"
password: "password"
Dockerfile
FROM node:alpine AS node-builder
WORKDIR /backend
COPY package*.json ./
RUN npm install
COPY tsconfig.json ./
COPY src/*.ts ./
RUN npx tsc
FROM heroiclabs/nakama:3.16.0
COPY --from=node-builder /backend/build/*.js /nakama/data/modules/build/
COPY my-config.yml /nakama/data/
docker-compose.yml
version: '3'
services:
postgres:
command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all
container_name: postgres
image: postgres:12.2-alpine
environment:
- POSTGRES_DB=nakama
- POSTGRES_PASSWORD=localdb
volumes:
- data:/var/lib/postgresql/data
expose:
- "8080"
- "5432"
ports:
- "5432:5432"
- "8080:8080"
healthcheck:
test: ["CMD", "pg_isready", "-U", "postgres", "-d", "nakama"]
interval: 3s
timeout: 3s
retries: 5
nakama:
build: .
container_name: nakama
image: registry.heroiclabs.com/heroiclabs/nakama:3.16.0
entrypoint:
- "/bin/sh"
- "-ecx"
- >
/nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
exec /nakama/nakama --name nakama1 --config /nakama/data/my-config.yml --database.address postgres:localdb@postgres:5432/nakama --logger.level DEBUG --session.token_expiry_sec 7200
links:
- "postgres:db"
depends_on:
postgres:
condition: service_healthy
volumes:
- ./data:/nakama/data
expose:
- "7349"
- "7350"
- "7351"
ports:
- "7349:7349"
- "7350:7350"
- "7351:7351"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:7350/"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
volumes:
data: