Here is a Dockerfile
with entrypoint.sh
designed to allow building your Next.js apps into a minimal docker image without exposing your ENV secrets.
To use create a .env.example with all of the ENV vars you will be using in your app but with a placeholder value.
Build your image
docker build -t <some_image_name> .
Run with image and new env vars
# use env file
docker run --env-file <location_of_actual_env_file> <some_image_name>
# passing env vars direct
docker run -e SOME_ENV_VAR=SOME_ENV_VAL <some_image_name>