Next.js Discord

Discord Forum

docker deploying - port configuration

Unanswered
zrndzdnz posted this in #help-forum
Open in Discord
whats the easiest way to allow for port configuration in .env, while deploying next.js app to docker? When running docker run my-app I want to specify env variable which will be the port of application. Currently I have entrypoint:

#!/bin/bash
set -e

/app/replace-variables.sh

PORT=${CLIENT_PORT:-3000}

exec npm run start -- -p $PORT
which Im running in dockerfile:

ENV CLIENT_PORT=3000

// some copies here

EXPOSE ${CLIENT_PORT}

ENTRYPOINT ["bash", "/app/entrypoint.sh"]
but that doesn't seem to work, the port is still 3000

0 Replies