🚀 Deploy Web App using Docker & SonarQube

🔗 View GitHub Repo

Step 1: Clone the Repository

Download your project from GitHub.

git clone https://github.com/Murali-Kaspa/HotelBooking.git cd HotelBooking

Step 2: Create a Dockerfile

Inside the project folder, create a Dockerfile.

nano Dockerfile

Step 3: Add Dockerfile Content

Copy this into Dockerfile.

FROM nginx COPY . /usr/share/nginx/html EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]

Step 4: Build & Run Docker Container

docker build -t my-webapp . docker run -d -p 80:80 --name my-webapp-container my-webapp

Step 5: Install SonarQube

docker run -d --name sonarqube -p 9000:9000 sonarqube:lts

Step 6: Install SonarScanner

wget https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-5.0.1.3006-linux.tar.gz tar -xvzf sonar-scanner-5.0.1.3006-linux.tar.gz sudo mv sonar-scanner-5.0.1.3006-linux /opt/sonar-scanner echo 'export PATH=$PATH:/opt/sonar-scanner/bin' >> ~/.bashrc source ~/.bashrc

Step 7: Configure SonarScanner

nano sonar-project.properties

Step 8: Run SonarScanner

sonar-scanner

🎉 Done!

Your web app is deployed using Docker, and its code is analyzed with SonarQube!