There is no mention of what/how to expose ports in Docker services

Would be nice if it provided a sample Dockerfile.

My Dockerfile is:

# syntax = docker/dockerfile:1.2

FROM node:18

RUN npm install -g pnpm@8.6.5

WORKDIR /app

COPY pnpm-lock.yaml .
COPY patches ./patches

RUN pnpm fetch

COPY . .

RUN pnpm install --frozen-lockfile --prefer-offline

RUN --mount=type=secret,id=_env_local,dst=/app/.env.local pnpm run build

CMD pnpm start

How do I know on what port to expose the service?

How do I make the mounted secrets available to CMD?

Also, the build/deploy logs exclude docker run command from the logs:

Jul 3 08:16:50 AM  ==> Cloning from https://github.com/lucgagan/rayrun-blog...
Jul 3 08:16:51 AM  ==> Checking out commit 8730772a142a2fcbe0b22c8c864d1b1058fb7258 in branch main
Jul 3 08:16:54 AM  #1 [internal] load .dockerignore
Jul 3 08:16:54 AM  #1 transferring context: 126B done
Jul 3 08:16:54 AM  #1 DONE 0.0s

Thus further obscures the debugging experience.

The service itself appears to be crashing (?) in a loop:

Jul 3 08:27:16 AM  > blog@0.1.0 start /app
Jul 3 08:27:16 AM  > next start
Jul 3 08:27:16 AM  
Jul 3 08:27:25 AM  - ready started server on 0.0.0.0:10000, url: http://localhost:10000
Jul 3 08:27:34 AM  - warn You have enabled experimental features (serverActions, esmExternals, serverComponentsExternalPackages) in next.config.mjs.
Jul 3 08:27:34 AM  - warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
Jul 3 08:27:34 AM  
Jul 3 08:28:38 AM  
Jul 3 08:28:38 AM  > blog@0.1.0 start /app
Jul 3 08:28:38 AM  > next start
Jul 3 08:28:38 AM  
Jul 3 08:28:46 AM  - ready started server on 0.0.0.0:10000, url: http://localhost:10000
Jul 3 08:28:54 AM  - warn You have enabled experimental features (serverActions, esmExternals, serverComponentsExternalPackages) in next.config.mjs.
Jul 3 08:28:54 AM  - warn Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use at your own risk.
Jul 3 08:28:54 AM  

Not clear why next start is run multiple times without an error in between.