From 4b857e8b09e3c5140be02523e9f9ebe8f6576447 Mon Sep 17 00:00:00 2001 From: "sagargurung1001@gmail.com" Date: Thu, 31 Aug 2023 16:53:50 +0545 Subject: [PATCH] Containerize a web app with docker-compose --- src/assets/DockerCompose/docker_compose.md | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 src/assets/DockerCompose/docker_compose.md diff --git a/src/assets/DockerCompose/docker_compose.md b/src/assets/DockerCompose/docker_compose.md new file mode 100644 index 0000000..929d7a9 --- /dev/null +++ b/src/assets/DockerCompose/docker_compose.md @@ -0,0 +1,34 @@ +--- +title: Containerize a Web Application using docker compose +authorName: Sagar Gurung +authorAvatar: https://avatars.githubusercontent.com/u/46086950?v=4 +authorLink: https://github.com/SagarGi +createdAt: Aug 31, 2023 +tags: docker-compose, docker, containerization,yaml +banner: https://raw.githubusercontent.com/DevExpress/testcafe-gh-page-assets/master/src/images/testcafe-ogp-icon.png +--- + +In this blog we will basically be containerizing a web application consisting of `MySQL`, `phpmyadmin`, `frontend` and `backend` as service using docker compose. +> Note: This article does not provide concepts of docker. If you like to know concepts of docker [visit here.](https://blog.jankaritech.com/#/blog/How%20to%20use%20selenium%20in%20docker%3F) + +Setting up an application can be a bit hefty if application is dependent to various services when setting up locally. But we can easily configure and containerize the whole application and its services in a single docker compose file and make the whole application running not only in your machine but in whole development environment. +In this blog we will make a basic `docker-compose.yaml` for a simple demo project to make it run through the `yaml` file in your machine. So lets get right into it. + +## Prerequisites +since we will be setting up a whole demo application locally first and also with docker compose file, the followings should be installed into your system before we start. +- [Node.js](https://nodejs.org/en) version 16 or above. +- MYSQL +- [Docker](https://docs.docker.com/engine/install/) +- And [docker compose](https://docs.docker.com/compose/install/) + +> Note: For this blog the whole setup is done in ubuntu 22.04 LTS + +## Setting up wep application locally +Before we begin to write and set up the docker compose file, lets set up the demo web application locally in your machine. +I have a web application which has frontend `demo-web` and backend `demo-server` in `github` publicly available. + +1. **Setting up frontend** + + Please follow the following steps to set up the `frontend` in your local machine +2. **Setting up database MYSQL** +3. **Setting up backend**