From 0e43bbdd15a433f80f4cea460f49ef5e3f67b1f1 Mon Sep 17 00:00:00 2001 From: Dmitri Algazin Date: Fri, 11 Jul 2025 12:34:35 +0100 Subject: [PATCH 1/2] feat: fixing dockerfile deployable jar; --- Dockerfile | 12 +++++++----- docker-compose.yml | 19 +++++++++++++++---- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5e9065..a781849 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,9 @@ ARG BASE_IMAGE FROM ${BASE_IMAGE:-openjdk:21-jdk-slim} -# ---- Runtime arguments ---- -ARG JAR_FILENAME=app.jar +# ---- Set runtime ENV for Spring Boot to bind port +ARG SERVER_PORT +ENV SERVER_PORT=${SERVER_PORT:-4550} # ---- Dependencies ---- RUN apt-get update \ @@ -11,12 +12,13 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # ---- Application files ---- -COPY build/libs/${JAR_FILENAME} /opt/app/${JAR_FILENAME} +COPY build/libs/service-cp-crime-schedulingandlisting-courtschedule-*.jar /opt/app/app.jar COPY lib/applicationinsights.json /opt/app/ # ---- Permissions ---- -RUN chmod 755 /opt/app/$JAR_FILENAME +RUN chmod 755 /opt/app/app.jar # ---- Runtime ---- EXPOSE 4550 -CMD ["java", "-jar", "/opt/app/$JAR_FILENAME"] \ No newline at end of file + +CMD ["java", "-jar", "/opt/app/app.jar"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index e092dd1..3c2c86d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,7 +1,9 @@ -version: '2.1' +version: '3.8' services: - service-cp-refdata-courthearing-judges: + service-cp-crime-schedulingandlisting-courtschedule: + env_file: + - .env build: context: . dockerfile: Dockerfile @@ -9,12 +11,21 @@ services: http_proxy: ${http_proxy} https_proxy: ${https_proxy} no_proxy: ${no_proxy} - BASE_IMAGE: ${BASE_IMAGE} + BASE_IMAGE: ${BASE_IMAGE:-openjdk:21-jdk-slim} + SERVER_PORT: ${SERVER_PORT:-4550} + environment: + - SERVER_PORT=${SERVER_PORT:-4550} ports: - - $SERVER_PORT:$SERVER_PORT + - "${SERVER_PORT:-4550}:${SERVER_PORT:-4550}" + networks: + - service-network healthcheck: test: [ "CMD", "curl", "-f", "http://localhost:${SERVER_PORT}/health" ] interval: 30s timeout: 10s retries: 3 start_period: 5s + +networks: + service-network: + name: service-cp-crime-schedulingandlisting-courtschedule-network \ No newline at end of file From a753794431e42718efb5d6804981a4c5664a65aa Mon Sep 17 00:00:00 2001 From: Dmitri Algazin Date: Fri, 11 Jul 2025 13:14:38 +0100 Subject: [PATCH 2/2] feat: fixing dockerfile deployable jar; --- .github/workflows/ci-build-publish.yml | 4 ++-- Dockerfile | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci-build-publish.yml b/.github/workflows/ci-build-publish.yml index db10cb6..71d0b27 100644 --- a/.github/workflows/ci-build-publish.yml +++ b/.github/workflows/ci-build-publish.yml @@ -105,7 +105,7 @@ jobs: - name: Upload JAR Artefact uses: actions/upload-artifact@v4 with: - name: app-jar + name: app.jar path: build/libs/${{ steps.repo_vars.outputs.artefact_name }}.jar Build-Docker: @@ -119,7 +119,7 @@ jobs: - name: Download JAR Artefact uses: actions/download-artifact@v4 with: - name: app-jar + name: app.jar path: build/libs - name: Set up Docker Buildx diff --git a/Dockerfile b/Dockerfile index a781849..5bd8733 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,7 +12,7 @@ RUN apt-get update \ && rm -rf /var/lib/apt/lists/* # ---- Application files ---- -COPY build/libs/service-cp-crime-schedulingandlisting-courtschedule-*.jar /opt/app/app.jar +COPY build/libs/*.jar /opt/app/app.jar COPY lib/applicationinsights.json /opt/app/ # ---- Permissions ----