diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..8d639cf3 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,12 @@ +.git +.github +.gradle +**/build +**/out +**/target +.idea +.vscode +**/*.iml +**/*.ipr +**/*.iws +**/.DS_Store \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..cd3dfb94 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,29 @@ +FROM amazoncorretto:21-alpine AS builder + +WORKDIR /app + +COPY . . + +RUN ./gradlew clean :infrastructure:bootJar --no-daemon + +FROM amazoncorretto:21-alpine + +WORKDIR /app + +RUN mkdir -p /app/storage && chmod -R 777 /app/storage + +COPY --from=builder /app/build/libs/application.jar app.jar + +ENV SPRING_PROFILES_ACTIVE=local +ENV KEYCLOAK_REALM=callv2 +ENV KEYCLOAK_HOST=http://localhost:8090 +ENV POSTGRES_HOST=localhost +ENV POSTGRES_PORT=5432 +ENV POSTGRES_DATABASE=callv2 +ENV POSTGRES_USERNAME=callv2 +ENV POSTGRES_PASSWORD=callv2 +ENV STORAGE_LOCATION=/app/storage + +EXPOSE 8080 + +ENTRYPOINT ["sh", "-c", "java -jar /app/app.jar --spring.profiles.active=${SPRING_PROFILES_ACTIVE}"] \ No newline at end of file diff --git a/infrastructure/build.gradle b/infrastructure/build.gradle index 4db40c4e..94e67b65 100644 --- a/infrastructure/build.gradle +++ b/infrastructure/build.gradle @@ -6,7 +6,11 @@ plugins { } group = 'com.callv2' -version = '1.0-SNAPSHOT' + +bootJar { + archiveFileName = 'application.jar' + destinationDirectory = file("${rootProject.buildDir}/libs") +} repositories { mavenCentral() diff --git a/infrastructure/src/main/resources/application-hmg.yml b/infrastructure/src/main/resources/application-hmg.yml new file mode 100644 index 00000000..902c7b9c --- /dev/null +++ b/infrastructure/src/main/resources/application-hmg.yml @@ -0,0 +1,14 @@ +keycloak: + realm: ${KEYCLOAK_REALM} + host: ${KEYCLOAK_HOST} + +postgres: + host: ${POSTGRES_HOST} + port: ${POSTGRES_PORT} + database: ${POSTGRES_DATABASE} + username: ${POSTGRES_USERNAME} + password: ${POSTGRES_PASSWORD} + +storage: + file-system: + location: ${STORAGE_LOCATION} \ No newline at end of file diff --git a/infrastructure/src/main/resources/application-local.yml b/infrastructure/src/main/resources/application-local.yml index 144ca9e0..a3d66db9 100644 --- a/infrastructure/src/main/resources/application-local.yml +++ b/infrastructure/src/main/resources/application-local.yml @@ -1,10 +1,6 @@ keycloak: realm: callv2 host: http://localhost:8090 - client: - user-api: - client-id: user-api - client-secret: local-client-secret postgres: host: localhost