From 7aaf4d0761c530e749ea27b956ac12946e222f9d Mon Sep 17 00:00:00 2001 From: Gerardo Date: Sun, 23 Jun 2024 05:26:07 -0600 Subject: [PATCH 1/2] Update README.md Added docker instructions in Readme file --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7920d13..380ea23 100644 --- a/README.md +++ b/README.md @@ -31,9 +31,22 @@ - IDE/Tool : Spring Tool Suite 4 (Eclipse) +## Installation (with Docker) : +Make sure you have Docker and Docker Compose installed, that the Docker daemon is running, and that port 80 is open, then execute: -## Installation : + docker-compose up -d + +After a few minutes, when the containers are completely started, you can add a sample Admin user with this command: + + docker exec my-mysql mysql -u root -proot -e "insert into businessproject.admin (admin_email, admin_name, admin_number, admin_password) VALUES ('admin@mail.com', 'Admin', '123', 'admin');" + +Then go to the `http://server_ip/home` and login with this credentials: + + user: admin@mail.com + pass: admin + +## Installation (without Docker): 1. Clone the repository : $ git clone https://github.com/SuhasKamate/Business_Management_Project.git
From d6b0bf46e70e50ceef5cd9999b9e813a37432f83 Mon Sep 17 00:00:00 2001 From: Gerry Miranda Date: Sun, 23 Jun 2024 11:27:25 +0000 Subject: [PATCH 2/2] Adding docker files --- DockerfileJAVA | 13 +++++++++++++ DockerfileMysql | 3 +++ docker-compose.yml | 29 +++++++++++++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 DockerfileJAVA create mode 100644 DockerfileMysql create mode 100644 docker-compose.yml diff --git a/DockerfileJAVA b/DockerfileJAVA new file mode 100644 index 0000000..4993e9a --- /dev/null +++ b/DockerfileJAVA @@ -0,0 +1,13 @@ +FROM maven:3.9-eclipse-temurin-17-alpine + +COPY . /usr/src/mymaven + +WORKDIR /usr/src/mymaven + +# Add DB Dialect +RUN echo "spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect" >> src/main/resources/application.properties + +RUN sed -i 's/localhost/my-mysql/g' src/main/resources/application.properties + +ENTRYPOINT ["mvn"] +CMD ["spring-boot:run"] diff --git a/DockerfileMysql b/DockerfileMysql new file mode 100644 index 0000000..443d0c3 --- /dev/null +++ b/DockerfileMysql @@ -0,0 +1,3 @@ +FROM mysql:8.4 + +EXPOSE 3306 diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..b0a43cd --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,29 @@ +name: bizmgmtapp + +services: + # Java service + java: + build: + context: . + dockerfile: DockerfileJAVA + container_name: bizmgmtapp + ports: + - "80:2330" + depends_on: + - my-mysql + + # MySQL service + my-mysql: + build: + context: . + dockerfile: DockerfileMysql + container_name: my-mysql + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: root + MYSQL_DATABASE: businessproject + MYSQL_USER: bizmgmtuser + MYSQL_PASSWORD: bizmgmtpass + volumes: + - /mysqldata:/var/lib/mysql