Problems with delve and docker

Here are my dockerfile and docker-compose fie

FROM registry.heroiclabs.com/heroiclabs/nakama-pluginbuilder:3.15.0 AS builder
ENV GO111MODULE on
ENV CGO_ENABLED 1
WORKDIR /backend
COPY . .


RUN apt-get update && \
    apt-get -y upgrade && \
    apt-get install -y --no-install-recommends gcc libc6-dev

RUN go build --trimpath --gcflags "all=-N -l" --mod=vendor --buildmode=plugin -o ./backend.so
RUN go install github.com/go-delve/delve/cmd/dlv@latest

FROM registry.heroiclabs.com/heroiclabs/nakama-dsym:3.15.0

COPY --from=builder /go/bin/dlv /nakama
COPY --from=builder /backend/backend.so /nakama/data/modules
COPY --from=builder /backend/local.yml /nakama/data/
COPY --from=builder /backend/map.json /nakama/data/modules/
COPY --from=builder /backend/halmgaard-shared/pricelist.json /nakama/data/modules/
COPY --from=builder /backend/halmgaard-shared/blueprints* /nakama/data/modules/blueprints/
version: '3'
services:
  postgres:
    command: postgres -c shared_preload_libraries=pg_stat_statements -c pg_stat_statements.track=all
    environment:
      - POSTGRES_DB=nakama
      - POSTGRES_PASSWORD=localdb
    expose:
      - "8080"
      - "5432"
    image: postgres:12.2-alpine
    ports:
      - "5432:5432"
      - "8080:8080"
    volumes:
      - data:/var/lib/postgresql/data
  nakama:
    build:
        context: .
        dockerfile: Dockerfile
    entrypoint:
      - "/bin/sh"
      - "-ecx"
      - >

        /nakama/nakama migrate up --database.address postgres:localdb@postgres:5432/nakama &&
        /nakama/dlv --log --log-output=debugger --listen=:4000 --headless=true --api-version=2 exec nakama/nakama -- --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama        
    depends_on:
      - postgres
    expose:
      - "7349"
      - "7350"
      - "7351"
      - "2345"
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:7350/"]
      interval: 10s
      timeout: 5s
      retries: 5
    links:
      - "postgres:db"
    ports:
      - "7349:7349"
      - "7350:7350"
      - "7351:7351"
      - "2345:2345"
      - "4000:4000"
    restart: unless-stopped
    security_opt:
      - "seccomp:unconfined"
    stdin_open: true
    tty: true
volumes:
  data:

And i get this error while docker-compose up

nakama_1    | {"level":"info","ts":"2023-03-09T07:40:31.875Z","caller":"migrate/migrate.go:155","msg":"Database connection","dsn":"postgres://postgres:xxxxx@postgres:5432/nakama?sslmode=prefer"}
nakama_1    | {"level":"info","ts":"2023-03-09T07:40:32.000Z","caller":"migrate/migrate.go:203","msg":"Database information","version":"PostgreSQL 12.2 on aarch64-unknown-linux-musl, compiled by gcc (Alpine 9.2.0) 9.2.0, 64-bit"}
nakama_1    | {"level":"info","ts":"2023-03-09T07:40:32.041Z","caller":"migrate/migrate.go:226","msg":"Successfully applied migration","count":0}
nakama_1    | + /nakama/dlv --log --log-output=debugger --listen=:4000 --headless=true --api-version=2 exec nakama/nakama -- --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama
nakama_1    | API server listening at: [::]:4000
nakama_1    | 2023-03-09T07:40:32Z warning layer=rpc Listening for remote connections (connections are not authenticated nor encrypted)
nakama_1    | 2023-03-09T07:40:32Z info layer=debugger launching process with args: [nakama/nakama --config /nakama/data/local.yml --database.address postgres:localdb@postgres:5432/nakama]
nakama_1    | could not launch process: open /nakama/nakama/nakama: not a directory
halmgaard-server_nakama_1 exited with code 1

I’m a complete rookie at docker. Any ideas why this is happening? The files are more or less just copied from the docs

I think you should give the full path to the binary after exec: “(…) exec /nakama/nakama (…)”

@sesposito Not sure exacly what u are referring to with (…) . But i tried /nakama/nakama and a new error occured: could not launch process: fork/exec /nakama/nakama: function not implemented. Any ideas? :slight_smile:

Edit: Might be a problem with M1. I’ll give it a go on my linux machine later.

I just used the (…) to omit the rest of the command, unfortunately I don’t know what the issue might be.

Been reading up on it, seems to be a problem with mac with M1 processors combined with docker. Ill just leave it as it is. Thanks for the help though :slight_smile: