Skip to content

Commit 9bcbf5d

Browse files
feat: fixing dockerfile deployable jar; (#50)
1 parent d354985 commit 9bcbf5d

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

Dockerfile

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,23 @@
22
ARG BASE_IMAGE
33
FROM ${BASE_IMAGE:-openjdk:21-jdk-slim}
44

5-
# ---- Runtime arguments ----
6-
ARG JAR_FILENAME=app.jar
5+
# ---- Set runtime ENV for Spring Boot to bind port
6+
ARG SERVER_PORT
7+
ENV SERVER_PORT=${SERVER_PORT:-4550}
78

89
# ---- Dependencies ----
910
RUN apt-get update \
1011
&& apt-get install -y curl \
1112
&& rm -rf /var/lib/apt/lists/*
1213

1314
# ---- Application files ----
14-
COPY build/libs/${JAR_FILENAME} /opt/app/${JAR_FILENAME}
15+
COPY build/libs/service-cp-crime-schedulingandlisting-courtschedule-*.jar /opt/app/app.jar
1516
COPY lib/applicationinsights.json /opt/app/
1617

1718
# ---- Permissions ----
18-
RUN chmod 755 /opt/app/$JAR_FILENAME
19+
RUN chmod 755 /opt/app/app.jar
1920

2021
# ---- Runtime ----
2122
EXPOSE 4550
22-
CMD ["java", "-jar", "/opt/app/$JAR_FILENAME"]
23+
24+
CMD ["java", "-jar", "/opt/app/app.jar"]

docker-compose.yml

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,31 @@
1-
version: '2.1'
1+
version: '3.8'
22

33
services:
4-
service-cp-refdata-courthearing-judges:
4+
service-cp-crime-schedulingandlisting-courtschedule:
5+
env_file:
6+
- .env
57
build:
68
context: .
79
dockerfile: Dockerfile
810
args:
911
http_proxy: ${http_proxy}
1012
https_proxy: ${https_proxy}
1113
no_proxy: ${no_proxy}
12-
BASE_IMAGE: ${BASE_IMAGE}
14+
BASE_IMAGE: ${BASE_IMAGE:-openjdk:21-jdk-slim}
15+
SERVER_PORT: ${SERVER_PORT:-4550}
16+
environment:
17+
- SERVER_PORT=${SERVER_PORT:-4550}
1318
ports:
14-
- $SERVER_PORT:$SERVER_PORT
19+
- "${SERVER_PORT:-4550}:${SERVER_PORT:-4550}"
20+
networks:
21+
- service-network
1522
healthcheck:
1623
test: [ "CMD", "curl", "-f", "http://localhost:${SERVER_PORT}/health" ]
1724
interval: 30s
1825
timeout: 10s
1926
retries: 3
2027
start_period: 5s
28+
29+
networks:
30+
service-network:
31+
name: service-cp-crime-schedulingandlisting-courtschedule-network

0 commit comments

Comments
 (0)