-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added Docker dependency in pom.xml. Added Dockerfile, docker-compose …
…properties and added .env to gitignore.
- Loading branch information
1 parent
56913c9
commit c9a1041
Showing
5 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
|
@@ -30,4 +30,7 @@ build/ | |
!**/src/test/**/build/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
.vscode/ | ||
|
||
### Docker ### | ||
/.env |
This file contains 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,16 @@ | ||
# Builder stage | ||
FROM openjdk:21-jdk-slim as builder | ||
WORKDIR application | ||
ARG JAR_FILE=target/*.jar | ||
COPY ${JAR_FILE} application.jar | ||
RUN java -Djarmode=layertools -jar application.jar extract | ||
|
||
# Final stage | ||
FROM openjdk:21-jdk-slim | ||
WORKDIR application | ||
COPY --from=builder application/dependencies/ ./ | ||
COPY --from=builder application/spring-boot-loader/ ./ | ||
COPY --from=builder application/snapshot-dependencies/ ./ | ||
COPY --from=builder application/application/ ./ | ||
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"] | ||
EXPOSE 8080 |
This file contains 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,34 @@ | ||
version: "3.8" | ||
|
||
services: | ||
mysqldb: | ||
image: mysql:8 | ||
restart: always | ||
environment: | ||
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD} | ||
MYSQL_DATABASE: ${MYSQL_DATABASE} | ||
ports: | ||
- "${MYSQL_LOCAL_PORT}:${MYSQL_DOCKER_PORT}" | ||
healthcheck: | ||
test: ["CMD-SHELL", "mysqladmin ping -h localhost -P ${MYSQL_DOCKER_PORT} -u ${MYSQL_USER} -p${MYSQL_ROOT_PASSWORD}"] | ||
interval: 30s | ||
timeout: 10s | ||
retries: 3 | ||
|
||
app: | ||
depends_on: | ||
mysqldb: | ||
condition: service_healthy | ||
image: book-service | ||
build: . | ||
ports: | ||
- "${SPRING_LOCAL_PORT}:${SPRING_DOCKER_PORT}" | ||
- "${DEBUG_PORT}:${DEBUG_PORT}" | ||
environment: | ||
SPRING_APPLICATION_JSON: '{ | ||
"spring.datasource.url": "jdbc:mysql://mysqldb:${MYSQL_DOCKER_PORT}/${MYSQL_DATABASE}?serverTimezone=UTC", | ||
"spring.datasource.username": "${MYSQL_USER}", | ||
"spring.datasource.password": "${MYSQL_ROOT_PASSWORD}", | ||
"jwt.secret": "${JWT_SECRET}" | ||
}' | ||
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005" |
This file contains 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
This file contains 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