Multi-Stage Dockerfile that builds a Node.js application and deploy artifacts in Apache httpd server
In this Dockerfile, there are two stages. The first stage uses the node:latest image to build a Node.js application. It sets the working directory to /app, copies the package*.json files, installs dependencies, copies the application code, and runs the build command. The build artifacts are saved in the dist/ directory. The second stage uses the httpd:latest image to build an Apache httpd server. It copies the dist/ directory from the first stage to the Apache server's default document root at /usr/local/apache2/htdocs/.
Multi-Stage Dockerfile that builds a Node.js application and deploy artifacts in Apache httpd server In this Dockerfile, there are two stages. The first stage uses the node:latest image to build a Node.js application. It sets the working directory to /app, copies the package*.json files, installs dependencies, copies the application code, and runs the build command. The build artifacts are saved in the dist/ directory. The second stage uses the httpd:latest image to build an Apache httpd server. It copies the dist/ directory from the first stage to the Apache server's default document root at /usr/local/apache2/htdocs/. dev-ops
MultiStage Dockerfile build Nodejs application deploy artifact Apache httpd server Dockerfile two stage first stage us nodelatest image build Nodejs application set working directory app copy packagejson file installs dependency copy application code run build command build artifact saved dist directory second stage us httpdlatest image build Apache httpd server copy dist directory first stage Apache server default document root usrlocalapache2htdocs devops