Skip to content
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
12 changes: 12 additions & 0 deletions .env
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For review purposes it's fine, but we should never push the changes with a .env file. The reason is that, this .env is environment specific. On our PC there might be a MySQL server running locally with a different username and password.
Similarly, Another team member may spin up a container and point to a MySQL server running on cloud.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#db environment variables
MYSQL_ROOT_PASSWORD=root
MYSQL_DATABASE=usersystem
MYSQL_PASSWORD=root
MYSQL_TCP_PORT=3307

#app environment variables
SPRING_DATASOURCE_URL=jdbc:mysql://mysql:3307/usersystem?useSSL=false&serverTimezone=UTC&createDatabaseIfNotExist=true&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME=root
SPRING_DATASOURCE_PASSWORD=root
SPRING_JPA_HIBERNATE_DDL_AUTO=update
SPRING_JPA_SHOW_SQL="true"
19 changes: 19 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM maven:3.8.1-openjdk-17 AS build
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "build" alias supposed to be used anywhere ?


WORKDIR /app

COPY ./app/src ./src
COPY ./app/LICENSE .
COPY ./app/mvnw.cmd .
COPY ./app/mvnw .
COPY ./app/pom.xml .


RUN mvn clean package -DskipTests

WORKDIR /app/target




CMD ["java", "-jar", "rihal-0.0.1-SNAPSHOT.jar"]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
45 changes: 45 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
version: '3.8'

services:
mysql:
image: mysql:9.0.0
container_name: mysql-cont
ports:
- "3307:3307"
environment:
- MYSQL_ROOT_PASSWORD
- MYSQL_DATABASE
- MYSQL_PASSWORD
- MYSQL_TCP_PORT
volumes:
- mysql_data:/var/lib/mysql
networks:
- my_network
restart: on-failure

userapp:
build: .
image: userinfostoreapp-userapp
container_name: userapp-cont
ports:
- 8080:8080
environment:
- SPRING_DATASOURCE_URL
- SPRING_DATASOURCE_USERNAME
- SPRING_DATASOURCE_PASSWORD
- SPRING_JPA_HIBERNATE_DDL_AUTO
- SPRING_JPA_SHOW_SQL
depends_on:
- mysql
networks:
- my_network
restart: on-failure

volumes:
mysql_data:

networks:
my_network: {}