Skip to content

Commit

Permalink
Merge pull request #14 from ShulV/feature-xmap-5-docker
Browse files Browse the repository at this point in the history
add docker compose
  • Loading branch information
Dandenet authored Nov 2, 2023
2 parents cf5609d + c2eba2c commit 027a6ad
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 8 deletions.
23 changes: 19 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
#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"]
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 1 addition & 1 deletion src/main/resources/application-dev.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 027a6ad

Please sign in to comment.