This project demonstrates how to use Docker and Docker Compose to set up a simple environment with MySQL, NGINX, and Node.js. The services are defined in the docker-compose.yml file, and the folder structure includes configurations for each service.
- The
mysqlfolder contains the Dockerfile and aninit.sqlscript to initialize the database. - To manage the MySQL database setup, the
init.sqlscript is executed when the container is started.
- The
nginxfolder contains the Dockerfile andnginx.confconfiguration file. - The Dockerfile sets up an NGINX server and uses the custom configuration (
nginx.conf) to replace the default configuration.
- The
nodefolder contains a simple Node.js application defined inindex.js. - The Dockerfile builds the Node.js application and installs the dependencies specified in
package.json.
RUN rm /etc/nginx/conf.d/default.confCOPY nginx.conf /etc/nginx/conf.ddocker network create --driver bridge nameNetworkdocker network listdocker network prunedocker run -d --network nameNetwork --name nameContainer nameImageCreatedocker-compose updocker-compose psdocker-compose up --builddocker-compose up -d