Skip to content

Commit

Permalink
Some changes to docker
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonBabychP1T committed Dec 20, 2023
1 parent 4840193 commit 981550a
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MYSQL_USER=myuser
MYSQL_USER=admin123
MYSQL_PASSWORD=password
MYSQL_DATABASE=book_store
MYSQL_ROOT_PASSWORD=password
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ 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.JarLauncher"]
ENTRYPOINT ["java", "org.springframework.boot.loader.launch.JarLauncher"]
EXPOSE 8080
30 changes: 13 additions & 17 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: "3.8"

services:
db:
image: mysql:latest
mysqldb:
image: mysql
restart: unless-stopped
env_file: ./.env
ports:
Expand All @@ -12,14 +12,10 @@ services:
MYSQL_DATABASE: $MYSQL_DATABASE
MYSQL_USER: $MYSQL_USER
MYSQL_PASSWORD: $MYSQL_PASSWORD
healthcheck:
test: [ "CMD", "mysql_isready -U mysql" ]
interval: 30s
timeout: 30s
retries: 3

app:
depends_on:
- db
- mysqldb
restart: on-failure
image: book-store-app
build: .
Expand All @@ -29,13 +25,13 @@ services:
- $DEBUG_PORT:$DEBUG_PORT
environment:
SPRING_APPLICATION_JSON: '{
"spring.datasource.url" : "jdbc:mysql://db:$MYSQL_DOCKER_PORT/$MYSQL_DATABASE",
"spring.datasource.username" : "$MYSQL_USER",
"spring.datasource.password" : "$MYSQL_PASSWORD",
"spring.datasource.driver-class-name" : "com.mysql.cj.jdbc.Driver",
"spring.jpa.hibernate.ddl-aut" : "validate",
"spring.jpa.show-sql" : "true",
"jwt.expiration" : "$JWT_EXPIRATION_TIME",
"jwt_secret" : "$JWT_SECRET"
}'
"spring.datasource.url" : "jdbc:mysql://mysqldb:$MYSQL_DOCKER_PORT/$MYSQL_DATABASE?serverTimezone=UTC",
"spring.datasource.username" : "$MYSQL_USER",
"spring.datasource.password" : "$MYSQL_PASSWORD",
"spring.datasource.driver-class-name" : "com.mysql.cj.jdbc.Driver",
"spring.jpa.hibernate.ddl-aut" : "validate",
"spring.jpa.show-sql" : "true",
"jwt.expiration" : "$JWT_EXPIRATION_TIME",
"jwt_secret" : "$JWT_SECRET"
}'
JAVA_TOOL_OPTIONS: "-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5005"
4 changes: 4 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-docker-compose</artifactId>
</dependency>
</dependencies>

<build>
Expand Down
11 changes: 2 additions & 9 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
spring.datasource.url=jdbc:mysql://localhost:${MYSQL_DOCKER_PORT}\
/${MYSQL_DATABASE}?serverTimeZone=UTC
spring.datasource.username=${MYSQL_USER}
spring.datasource.password=${MYSQL_ROOT_PASSWORD}
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver

spring.jpa.hibernate.ddl-auto=validate
spring.jpa.show-sql=true

jwt.expiration=${JWT_EXPIRATION_TIME}
jwt.secret=${JWT_SECRET}


jwt.expiration=1000000
jwt.secret=p1tbookstoreappsomerandomsymholstokey1231488p1t
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
package store.bookstoreapp;

import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class BookStoreAppApplicationTests {

@Test
void contextLoads() {
}

}

0 comments on commit 981550a

Please sign in to comment.