Skip to content

Commit 6176003

Browse files
authored
Merge pull request #172 from anderslindho/compose
Improve docker and compose setup
2 parents 2b37cb4 + 4fa1579 commit 6176003

15 files changed

+53
-56
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:

.gitignore

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
1+
### Build and Compilation ###
12
/target/
2-
.settings
33
/bin/
4+
5+
### Editor ###
6+
.settings/
7+
.settings/org.eclipse.core.resources.prefs
8+
.settings/org.eclipse.jdt.core.prefs
9+
.settings/org.eclipse.m2e.core.prefs
410
/.project
511
/.classpath
612
.pydevproject
713
*.iml
8-
*.log
9-
**/site/sphinx/build/*
1014
.idea
15+
.vscode/
16+
*.swp
17+
*.swo
18+
*~
1119

12-
### Eclipse ###
13-
.settings/org.eclipse.core.resources.prefs
14-
.settings/org.eclipse.jdt.core.prefs
15-
.settings/org.eclipse.m2e.core.prefs
20+
### Logs ###
21+
*.log
22+
spring-shell.log
1623

17-
### Docker ###
18-
docker-compose-local*
24+
### Documentation ###
25+
**/site/sphinx/build/*
1926

20-
### Spring ###
21-
spring-shell.log
27+
### Docker ###
28+
*compose*.yml
29+
!compose.yml

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"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ ChannelFinder is a Java EE5 REST-style web service. The directory data is held i
3939

4040
### Docker Compose
4141

42-
For using docker containers there is a barebones [docker compose file](./docker-compose.yml).
42+
For using docker containers there is a barebones [docker compose file](./compose.yml).
4343

4444
### Manual Installation
4545

docker-compose.yml renamed to compose.yml

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

2316
elasticsearch:
2417
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.2
25-
hostname: elasticsearch-cf
18+
hostname: elasticsearch
2619
networks:
2720
- channelfinder-net
2821
ports:
@@ -35,6 +28,11 @@ services:
3528
EPICS_PVAS_INTF_ADDR_LIST: "0.0.0.0"
3629
volumes:
3730
- 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
3836
volumes:
3937
channelfinder-es-data:
4038
driver: local

src/test/java/org/phoebus/channelfinder/docker/ChannelFinderChannelsIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
/**
3838
* Integration tests for ChannelFinder and Elasticsearch with focus on usage of
3939
* {@link org.phoebus.channelfinder.CFResourceDescriptors#CHANNEL_RESOURCE_URI}.
40-
* Existing dockerization is used with <tt>docker-compose-integrationtest.yml</tt> and <tt>Dockerfile.integrationtest</tt>.
4140
*
4241
* @author Lars Johansson
4342
*

src/test/java/org/phoebus/channelfinder/docker/ChannelFinderIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232
/**
3333
* Integration tests for ChannelFinder and Elasticsearch with focus on endpoints being available.
34-
* Existing dockerization is used with <tt>docker-compose-integrationtest.yml</tt> and <tt>Dockerfile.integrationtest</tt>.
3534
*
3635
* @author Lars Johansson
3736
*

src/test/java/org/phoebus/channelfinder/docker/ChannelFinderPropertiesIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
/**
3939
* Integration tests for ChannelFinder and Elasticsearch with focus on usage of
4040
* {@link org.phoebus.channelfinder.CFResourceDescriptors#PROPERTY_RESOURCE_URI}.
41-
* Existing dockerization is used with <tt>docker-compose-integrationtest.yml</tt> and <tt>Dockerfile.integrationtest</tt>.
4241
*
4342
* @author Lars Johansson
4443
*

src/test/java/org/phoebus/channelfinder/docker/ChannelFinderScrollIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
/**
3434
* Integration tests for ChannelFinder and Elasticsearch with focus on usage of
3535
* {@link org.phoebus.channelfinder.CFResourceDescriptors#SCROLL_RESOURCE_URI}.
36-
* Existing dockerization is used with <tt>docker-compose-integrationtest.yml</tt> and <tt>Dockerfile.integrationtest</tt>.
3736
*
3837
* @author Lars Johansson
3938
*

src/test/java/org/phoebus/channelfinder/docker/ChannelFinderTagsIT.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
/**
3939
* Integration tests for ChannelFinder and Elasticsearch with focus on usage of
4040
* {@link org.phoebus.channelfinder.CFResourceDescriptors#TAG_RESOURCE_URI}.
41-
* Existing dockerization is used with <tt>docker-compose-integrationtest.yml</tt> and <tt>Dockerfile.integrationtest</tt>.
4241
*
4342
* @author Lars Johansson
4443
*

0 commit comments

Comments
 (0)