Skip to content

Commit 4fa1579

Browse files
committed
Build project in container and improve compose
1 parent e038636 commit 4fa1579

File tree

3 files changed

+20
-24
lines changed

3 files changed

+20
-24
lines changed

.github/workflows/docker-release.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: Release docker image
32

43
on:
@@ -19,14 +18,6 @@ jobs:
1918
runs-on: ubuntu-latest
2019
steps:
2120
- uses: actions/checkout@v4
22-
- name: Set up JDK 17
23-
uses: actions/setup-java@v4
24-
with:
25-
java-version: '17'
26-
distribution: 'temurin'
27-
cache: maven
28-
- name: Build with Maven
29-
run: mvn --batch-mode --update-snapshots package
3021
- name: Log in to the Container registry
3122
uses: docker/login-action@v3
3223
with:

Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
FROM eclipse-temurin:17-jre
1+
# syntax=docker/dockerfile:1
22

3-
# deployment unit
4-
COPY target/ChannelFinder-*.jar /channelfinder/ChannelFinder-*.jar
3+
FROM eclipse-temurin:17-jdk AS builder
4+
WORKDIR /build
5+
RUN apt-get update && apt-get install -y maven
6+
COPY . .
7+
RUN mvn --batch-mode --update-snapshots clean package -DskipTests
58

6-
CMD ["java", "-jar", "/channelfinder/ChannelFinder-*.jar", "--spring.config.name=application"]
9+
FROM eclipse-temurin:17-jre AS runner
10+
WORKDIR /app
11+
COPY --from=builder /build/target/ChannelFinder-*.jar ./channelfinder.jar
12+
CMD ["java", "-jar", "/app/channelfinder.jar", "--spring.config.name=application"]

compose.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,21 +7,15 @@ services:
77
- channelfinder-net
88
ports:
99
- "8443:8443"
10-
depends_on:
11-
- elasticsearch
1210
environment:
13-
- ELASTICSEARCH_NETWORK_HOST=elasticsearch-cf
14-
command: >
15-
/bin/bash -c "
16-
until curl --silent --fail http://elasticsearch-cf:9200/_cluster/health; do
17-
echo 'Waiting for Elasticsearch'
18-
sleep 1
19-
done
20-
java -jar /channelfinder/ChannelFinder-*.jar"
11+
- ELASTICSEARCH_NETWORK_HOST=elasticsearch
12+
depends_on:
13+
elasticsearch:
14+
condition: service_healthy
2115

2216
elasticsearch:
2317
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.2
24-
hostname: elasticsearch-cf
18+
hostname: elasticsearch
2519
networks:
2620
- channelfinder-net
2721
ports:
@@ -34,6 +28,11 @@ services:
3428
EPICS_PVAS_INTF_ADDR_LIST: "0.0.0.0"
3529
volumes:
3630
- channelfinder-es-data:/usr/share/elasticsearch/data
31+
healthcheck:
32+
test: ["CMD", "curl", "-f", "http://localhost:9200/_cluster/health"]
33+
interval: 10s
34+
timeout: 5s
35+
retries: 3
3736
volumes:
3837
channelfinder-es-data:
3938
driver: local

0 commit comments

Comments
 (0)