Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dockerfile to run nodejs static-content in docker container

Need an advice to dockerize and run a node JS static-content app on K8s cluster.

I have a static web-content which I run "npm run build” into the terminal which generates /build and direct my IIS webserver to /build/Index.html.

Now, I started creating a Docker file, how do I point my nodeJS image to invoke /build/Index.html file

FROM node:carbon
WORKDIR /app
COPY /Core/* ./app
npm run build
EXPOSE 8080
CMD [ "node", ".app/build/index.html" ]

Please how can I run this app only on node v8.9.3 and npm 5.6.0 ?

Any inputs please ?

like image 603
Abraham Dhanyaraj Avatar asked Apr 23 '26 22:04

Abraham Dhanyaraj


1 Answers

You can specify the version of node specifically:

FROM node:8.9.3
like image 139
Jim B. Avatar answered Apr 26 '26 11:04

Jim B.