Skip to content

Commit

Permalink
Containerize a web app with docker-compose
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarGi committed Sep 15, 2023
1 parent 9d4cee7 commit 0e7422e
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions src/assets/DockerCompose/docker_compose.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
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.yml` for a simple demo web application to make it run through the `yaml` file in your machine. So lets get right into it.

## Prerequisites
For better understanding how we write a docker compose yaml file, it is better to understand how you set up the application locally in your machine. I urge to set the demo web application into your system. For that the following things needs to be installed.
- [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
I assume all the requirements above is installed in your machine. So, lets set up the demo web application locally.
I have a web application which has frontend `demo-web` and backend `demo-server` in `github` publicly available. It is a very basic web application built in `vue-js` that uses `mysql` as database. With this basic application we can register the user and view the registered user in the web.
Let's get right into setting it up.
1. To set up `front-end`, visit [demo-web](https://github.com/SagarGi/demo-web) and follow the `read-me` section to set up manually in your machine.
2. To set up `back-end`, visit [demo-server](https://github.com/SagarGi/demo-server) and follow the `read-me` section to set up manually in your machine.

> Note: Please follow the `read-me` set the application locally since it will be easier to write docker compose yaml file.

0 comments on commit 0e7422e

Please sign in to comment.