0

I dockerize a web application using docker-compose. So, I am using containers / services for "node", "traefik" and "db" (postgres db) within my docker-compose YAML file.

In my Dockerfile for "node" I want to finally build the production build and start the node server.

By using RUN npm run-script build, the razzle production build should be started to run. (in package.json for scripts-->build is set "razzle build".

My issue is that I wish to have everything automated, without providing responses on the command line manually after docker-compose up.

When I start the production build manually, I have to type "Y" to start it finally:

> razzle build

? This runs the production build, are you sure you want to run it? Add --noninteractive to remove this prompt. (Y/n)

And I got the following error after execution docker-compose build ...

> razzle build

? This runs the production build, are you sure you want to run it? Add
--noninteractive to remove this prompt. (Y/n) ERROR: Service 'node' failed to build: The command '/bin/sh -c npm run-script build -y' returned a non-zero code: 1

But how can I realize this automatically in the dockerfile?

I already tried:

Using -y flag: RUN npm run-script build -y

Using echo for providing the permission: RUN npm run-script build -y RUN ["echo", "'Y'"]

Or tried to change the session into noninteractive ARG DEBIAN_FRONTEND=noninteractive

but it did not work

Does anybody has a nice idea how to fix it in my dockerfile?

thanks in advance

0 Answers0