Skip to content

Commit

Permalink
implement code review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jan 5, 2025
1 parent b4d725c commit 486b1ba
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 11 deletions.
11 changes: 8 additions & 3 deletions jpa/boot-jpa-jooq-sample/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
FROM eclipse-temurin:21.0.5_11-jre-alpine as builder
WORKDIR application
WORKDIR /app
ARG JAR_FILE=target/boot-jpa-jooq-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} application.jar
RUN java -Djarmode=layertools -jar application.jar extract
Expand All @@ -9,10 +9,15 @@ FROM eclipse-temurin:21.0.5_11-jre-alpine
LABEL maintainer="rajadilipkolli" \
description="Spring Boot application with JPA and jOOQ integration" \
version="0.0.1-SNAPSHOT"
WORKDIR application
WORKDIR /app
COPY --from=builder application/dependencies/ ./
COPY --from=builder application/spring-boot-loader/ ./
COPY --from=builder application/snapshot-dependencies/ ./
COPY --from=builder application/application/ ./
ENV JAVA_OPTS="-XX:MaxRAMPercentage=75.0 -XX:InitialRAMPercentage=50.0"
ARG MAX_RAM_PERCENTAGE=75.0
ARG INITIAL_RAM_PERCENTAGE=50.0
ENV JAVA_OPTS="-XX:MaxRAMPercentage=${MAX_RAM_PERCENTAGE} -XX:InitialRAMPercentage=${INITIAL_RAM_PERCENTAGE}"
ENTRYPOINT ["sh", "-c", "java ${JAVA_OPTS} org.springframework.boot.loader.launch.JarLauncher"]

HEALTHCHECK --interval=30s --timeout=3s \
CMD wget --quiet --tries=1 --spider http://localhost:8080/actuator/health || exit 1
3 changes: 3 additions & 0 deletions jpa/boot-jpa-jooq-sample/docker/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
POSTGRES_DB=appdb
POSTGRES_USER=appuser
POSTGRES_PASSWORD=secret
6 changes: 3 additions & 3 deletions jpa/boot-jpa-jooq-sample/docker/docker-compose-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ services:
environment:
- SPRING_PROFILES_ACTIVE=docker
- SPRING_DATASOURCE_DRIVER_CLASS_NAME=org.postgresql.Driver
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgresqldb:5432/appdb
- SPRING_DATASOURCE_USERNAME=appuser
- SPRING_DATASOURCE_PASSWORD=secret
- SPRING_DATASOURCE_URL=jdbc:postgresql://postgresqldb:5432/${POSTGRES_DB}
- SPRING_DATASOURCE_USERNAME=${POSTGRES_USER}
- SPRING_DATASOURCE_PASSWORD=${POSTGRES_PASSWORD}
5 changes: 5 additions & 0 deletions jpa/boot-jpa-jooq-sample/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@
<artifactId>postgresql</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>net.ttddyy.observation</groupId>
<artifactId>datasource-micrometer-spring-boot</artifactId>
<version>1.0.6</version>
</dependency>

<dependency>
<groupId>org.springdoc</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ public void setDetails(PostDetails details) {

public void addTag(Tag tag) {
PostTag postTag = new PostTag(this, tag);
if (null == tags) {
tags = new ArrayList<>();
}
this.tags.add(postTag);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@

<addForeignKeyConstraint baseColumnNames="post_id" baseTableName="post_comments"
constraintName="FK_POST_COMMENT_ON_POST" referencedColumnNames="id"
referencedTableName="posts"/>
referencedTableName="posts"
onDelete="CASCADE"
onUpdate="CASCADE"/>
</changeSet>
</databaseChangeLog>
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@

<changeSet author="appUser" id="createTable-post-tag">
<createTable tableName="post_tag">
<column name="created_on" type="TIMESTAMPTZ"/>
<column name="created_on" type="TIMESTAMPTZ">
<constraints nullable="false"/>
</column>
<column name="post_id" type="BIGINT">
<constraints nullable="false" primaryKey="true" primaryKeyName="pk_post_tag"/>
</column>
Expand Down

0 comments on commit 486b1ba

Please sign in to comment.