diff --git a/Dockerfile b/Dockerfile index 5c8ebe8..923f08f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,6 @@ -FROM openjdk:11 as builder -WORKDIR application -ARG JAR_FILE=target/*.jar -COPY ${JAR_FILE} application.jar -RUN java -Djarmode=layertools -jar application.jar extract - FROM openjdk:11 -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.JarLauncher"] EXPOSE 8080 +WORKDIR application +ARG JAR_FILE=target/*.jar +ADD ${JAR_FILE} application.jar +ENTRYPOINT ["java","-jar","application.jar"] diff --git a/docker-compose.yml b/docker-compose.yml index b0bd32a..38c4534 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -9,12 +9,13 @@ services: environment: - MYSQL_ROOT_PASSWORD=$MYSQLDB_ROOT_PASSWORD - MYSQL_DATABASE=$MYSQLDB_DATABASE + - MYSQL_ROOT_HOST="%" ports: - $MYSQLDB_LOCAL_PORT:$MYSQLDB_DOCKER_PORT healthcheck: test: [ "CMD", "mysqladmin" ,"ping", "-h", "localhost" ] - timeout: 30s - retries: 3 + timeout: 60s + retries: 5 app: depends_on: mysqldb: @@ -31,6 +32,7 @@ services: "spring.datasource.url" : "jdbc:mysql://mysqldb:$MYSQLDB_DOCKER_PORT/$MYSQLDB_DATABASE", "spring.datasource.username" : "$MYSQLDB_USER", "spring.datasource.password" : "$MYSQLDB_ROOT_PASSWORD", + "spring.jpa.properties.hibernate.dialect" : "org.hibernate.dialect.MySQL8Dialect", "spring.datasource.driver-class-name" : "com.mysql.cj.jdbc.Driver", "spring.jpa.hibernate.ddl-auto" : "create-drop" }' diff --git a/src/main/java/org/company/aircompaniesmanager/controller/HealthController.java b/src/main/java/org/company/aircompaniesmanager/controller/HealthController.java deleted file mode 100644 index 76d8c42..0000000 --- a/src/main/java/org/company/aircompaniesmanager/controller/HealthController.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.company.aircompaniesmanager.controller; - -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.RestController; - -@RestController -public class HealthController { - @GetMapping("/health") - public String getHealth() { - return "Server is working..."; - } -} diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index bec7acd..af6c2b3 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -3,7 +3,7 @@ server.servlet.context-path=/api spring.datasource.url=jdbc:mysql://localhost:3306/air_companies_management spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver spring.datasource.username=root -spring.datasource.password=default +spring.datasource.password=${DB_PASSWORD} spring.jpa.database-platform=org.hibernate.dialect.MySQL8Dialect spring.jpa.open-in-view=false spring.jpa.show-sql=true