Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding Docker functionality #4

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions DockerfileJAVA
Original file line number Diff line number Diff line change
@@ -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"]
3 changes: 3 additions & 0 deletions DockerfileMysql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM mysql:8.4

EXPOSE 3306
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 ('[email protected]', 'Admin', '123', 'admin');"

Then go to the `http://server_ip/home` and login with this credentials:

user: [email protected]
pass: admin

## Installation (without Docker):

1. Clone the repository : $ git clone https://github.com/SuhasKamate/Business_Management_Project.git <br>

Expand Down
29 changes: 29 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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