Creating our Dockerfile

Our Dockerfile contains the receipt to build a Docker image with all the configuration we need to start our NGINX web server and also will contain the web application that has to be copied inside the container. Go ahead and create the Dockerfile file in the project root folder:

FROM nginx:alpine

COPY default.conf /etc/nginx/conf.d/default.conf

COPY index.html /usr/share/nginx/html/index.html
COPY dist /usr/share/nginx/html/scripts

Yeah, that's all! This is a simple Docker file that uses nginx:alphine as its base image. We COPY the default.conf file, which contains the NGINX configuration file, and, finally, we COPY our web application files.

That's it! let's build our Docker image and run our very first container.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset