diff --git a/Dockerfile b/Dockerfile index ca5da04..3143af6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,19 @@ -FROM openjdk:17 -EXPOSE 8080 -ADD target/spring-boot-spots-app.jar spring-boot-spots-app.jar -ENTRYPOINT ["java", "-jar", "/spring-boot-spots-app.jar"] \ No newline at end of file +#FROM maven:3.8.5-openjdk-17 +#WORKDIR /app +#COPY pom.xml . +#RUN mvn dependency:resolve +#COPY . . +#EXPOSE 8089 +# +#ENTRYPOINT ["mvn", "spring-boot:run"] + +FROM maven:3.8.5-openjdk-17 as builder +WORKDIR /app +COPY . /app/. +RUN mvn -f /app/pom.xml clean package -Dmaven.test.skip=true + +FROM eclipse-temurin:17-jre-alpine +WORKDIR /app +COPY --from=builder /app/target/*.jar /app/*.jar +EXPOSE 8089 +ENTRYPOINT ["java", "-jar", "/app/*.jar"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..18f6a3b --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,26 @@ +version: "3.9" +services: + postgres: + image: 'postgres' + ports: + - '5432:5432' + environment: + - 'POSTGRES_USER=postgres' + - 'POSTGRES_DB=spot_map' + - 'POSTGRES_PASSWORD=12345' + volumes: + - ../postgres_dir:/docker-entrypoint-initdb.d + - /var/lib/postgresql/data:/var/lib/postgresql/data:/var/lib/postgresql/data + server: + build: + context: . + dockerfile: Dockerfile + links: + - postgres + ports: + - '8080:8080' + volumes: + - /var/lib/postgresql/data:/var/lib/postgresql/data + +volumes: + postgres_data: \ No newline at end of file diff --git a/src/main/resources/application-dev.properties b/src/main/resources/application-dev.properties index 7037195..104afcc 100644 --- a/src/main/resources/application-dev.properties +++ b/src/main/resources/application-dev.properties @@ -7,7 +7,7 @@ spring.mvc.hiddenmethod.filter.enabled=true spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.url=jdbc:postgresql://localhost:5432/spot_map spring.datasource.username=postgres -spring.datasource.password=12345 +spring.datasource.password=mysecretpassword # hibernate config spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.properties.hibernate.show_sql=true diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 4b3c7a6..1fcd374 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,11 +1,11 @@ -server.address=127.0.0.1 +server.address=server # 192.168.43.192 -server.port=8089 +server.port=8080 # checks _method field via filter (for working PUT, PATCH, DELETE) spring.mvc.hiddenmethod.filter.enabled=true # db config spring.datasource.driver-class-name=org.postgresql.Driver -spring.datasource.url=jdbc:postgresql://localhost:5432/spot_map +spring.datasource.url=jdbc:postgresql://postgres:5432/spot_map spring.datasource.username=postgres spring.datasource.password=12345 # hibernate config