-
Notifications
You must be signed in to change notification settings - Fork 16
Added dockerfile and docker-compose #14
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
Open
f6ew
wants to merge
1
commit into
CodelineAtyab:main
Choose a base branch
from
f6ew:fatmaalrashdi-containerize-app
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| version: '3.8' | ||
|
|
||
| services: | ||
| mysql: | ||
| image: mysql:8.0 | ||
| container_name: mysql-cont2 | ||
| environment: | ||
| - MYSQL_ROOT_PASSWORD | ||
| - MYSQL_DATABASE | ||
| - MYSQL_PASSWORD | ||
| ports: | ||
| - "3307:3306" | ||
| volumes: | ||
| - mysql-data:/var/lib/mysql | ||
| networks: | ||
| - my_network | ||
| restart: on-failure | ||
|
|
||
| app: | ||
| build: . | ||
| container_name: springboot-app | ||
| ports: | ||
| - "8080:8080" | ||
| environment: | ||
| - SPRING_DATASOURCE_URL | ||
| - SPRING_DATASOURCE_USERNAME | ||
| - SPRING_DATASOURCE_PASSWORD | ||
| - SPRING_JPA_HIBERNATE_DDL_AUTO | ||
| - SPRING_JPA_SHOW_SQL | ||
| networks: | ||
| - my_network | ||
| depends_on: | ||
| - mysql | ||
| restart: on-failure | ||
|
|
||
| volumes: | ||
| mysql-data: {} | ||
|
|
||
| networks: | ||
| my_network: {} | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| # Stage 1: Build stage | ||
| FROM maven:3.8.1-openjdk-17 AS build | ||
| WORKDIR /app | ||
| COPY pom.xml . | ||
| RUN mvn dependency:go-offline -B | ||
| COPY src ./src | ||
| RUN mvn clean package -DskipTests | ||
|
|
||
| # Stage 2: Run stage | ||
| FROM openjdk:17-jdk-slim | ||
| WORKDIR /app | ||
| COPY --from=build /app/target/rihal-0.0.1-SNAPSHOT.jar app.jar | ||
|
|
||
| EXPOSE 8080 | ||
|
|
||
| # Correct CMD syntax | ||
| CMD ["java", "-jar", "app.jar"] | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Target directory can be excluded from the pull request changes as its host specific |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| spring.application.name=rihal | ||
| spring.datasource.url=${SPRING_DATASOURCE_URL} | ||
| spring.datasource.username=${SPRING_DATASOURCE_USERNAME} | ||
| spring.datasource.password=${SPRING_DATASOURCE_PASSWORD} | ||
| spring.jpa.hibernate.ddl-auto=update | ||
| spring.jpa.show-sql=true | ||
| spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL8Dialect | ||
| spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!DOCTYPE html> | ||
| <html xmlns:th="http://www.thymeleaf.org"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Edit User</title> | ||
| </head> | ||
| <body> | ||
| <h1>Edit User</h1> | ||
| <form action="#" th:action="@{/users/{id}(id=${user.id})}" th:object="${user}" method="post"> | ||
| <label>Name: </label> | ||
| <input type="text" th:field="*{name}" /><br> | ||
| <label>Email: </label> | ||
| <input type="email" th:field="*{email}" /><br> | ||
| <button type="submit">Save</button> | ||
| </form> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| <!DOCTYPE html> | ||
| <html xmlns:th="http://www.thymeleaf.org"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>User Management</title> | ||
| </head> | ||
| <body> | ||
| <h1>User Management</h1> | ||
| <a href="/users/new">Add New User</a> | ||
| <table> | ||
| <thead> | ||
| <tr> | ||
| <th>ID</th> | ||
| <th>Name</th> | ||
| <th>Email</th> | ||
| <th>Actions</th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr th:each="user : ${users}"> | ||
| <td th:text="${user.id}"></td> | ||
| <td th:text="${user.name}"></td> | ||
| <td th:text="${user.email}"></td> | ||
| <td> | ||
| <a th:href="@{/users/edit/{id}(id=${user.id})}">Edit</a> | ||
| <a th:href="@{/users/delete/{id}(id=${user.id})}">Delete</a> | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| <!DOCTYPE html> | ||
| <html xmlns:th="http://www.thymeleaf.org"> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <title>Add New User</title> | ||
| </head> | ||
| <body> | ||
| <h1>Add New User</h1> | ||
| <form action="#" th:action="@{/users}" th:object="${user}" method="post"> | ||
| <label>Name: </label> | ||
| <input type="text" th:field="*{name}" /><br> | ||
| <label>Email: </label> | ||
| <input type="email" th:field="*{email}" /><br> | ||
| <button type="submit">Save</button> | ||
| </form> | ||
| </body> | ||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| artifactId=rihal | ||
| groupId=com.docker | ||
| version=0.0.1-SNAPSHOT |
5 changes: 5 additions & 0 deletions
5
target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| com/docker/rihal/controllers/UserController.class | ||
| com/docker/rihal/RihalApplication.class | ||
| com/docker/rihal/models/User.class | ||
| com/docker/rihal/repositories/UserRepository.class | ||
| com/docker/rihal/services/UserService.class |
5 changes: 5 additions & 0 deletions
5
target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| /home/f6ew/UserInfoStoreApp/src/main/java/com/docker/rihal/RihalApplication.java | ||
| /home/f6ew/UserInfoStoreApp/src/main/java/com/docker/rihal/controllers/UserController.java | ||
| /home/f6ew/UserInfoStoreApp/src/main/java/com/docker/rihal/models/User.java | ||
| /home/f6ew/UserInfoStoreApp/src/main/java/com/docker/rihal/repositories/UserRepository.java | ||
| /home/f6ew/UserInfoStoreApp/src/main/java/com/docker/rihal/services/UserService.java |
Binary file not shown.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment mentioning the benefit of using go-offline -B
Isn't mvn clean package going to package the app with all the dependencies ?