Dockerizing customized node application

Developers had made one node.js app that runs on web. its running over linux server, but when im trying to make a Dockerfile and run the container isn’t getting started . i tried by creating 2 Dockerfile but still no result

Dockerfile1

FROM node

WORKDIR /usr/src/package

COPY package.json .

COPY package-lock.json .

RUN npm ci

COPY . .

RUN npm run build

CMD [“npm”, “start”]

Dockerfile 2

FROM node

WORKDIR /usr/src/package

COPY package.json .

RUN npm install

COPY . .

RUN npm run build

CMD [“npm”, “start”]

Are you getting some error when running the containers?

Yes, it says start missing

Funny, it was my first guess

In your package.json, within the scripts property, you don’t have a start script, do you?

Could you provide me the script that needs to be added in my package.json file.
and to note : there are two files as package.json .
one /package.json and other inside a directory api/package.json

That depends on what you’re using to start the project, how do you run it currently?

within package.json, there is a property called scripts, it can look like this:

{
     "scripts": {
        "start": "...",
        "build": "...",
        "test": "...",
        ...
    }
}

Each of those lines specifies a bash script that would be executed once you run npm run <script> (npm start = npm run start)

For example, if you had

{
    "scripts": {
        "start": "echo YES"
    }
}

Then npm start would do echo YES, and print the word ‘YES’

Within the start command in your package.json, put whatever you currently use to actually start the application

Thanks for the reply Sir, im trying out, i will update you

After adding
“start”: “echo YES”

still im getting an issue while building image it says

Dockerfile.171:7

5 | COPY package.json .
6 |
7 | >>> RUN npm install
8 |
9 | COPY . .

ERROR: failed to solve: process “/bin/sh -c npm install” did not complete successfully: exit code: 1

Is your JSON formatted correctly? Could you post it please?
Also, what aboutthe other dockerfile, in which you do npm ci instead of npm install? Same error?

By the way, please format your code like so:
json or dockerfile, etc.

your code here

could we connect over G meet, so i can show you live ?

Yes, you may email me a link at dev@deanayalon.com

i have mailed you on the given id