Skip to content

Commit 41aafb2

Browse files
authored
Merge pull request #132 from ChannelFinder/publish-docker
Add github action to upload docker image
2 parents d6e571b + a00c6bc commit 41aafb2

File tree

3 files changed

+49
-4
lines changed

3 files changed

+49
-4
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
2+
name: Release docker image
3+
4+
on:
5+
push:
6+
branches: [ "master" ]
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
jobs:
13+
build-and-push-image:
14+
permissions:
15+
contents: read
16+
packages: write
17+
runs-on: ubuntu-latest
18+
steps:
19+
- uses: actions/checkout@v3
20+
- name: Set up JDK 11
21+
uses: actions/setup-java@v3
22+
with:
23+
java-version: '11'
24+
distribution: 'temurin'
25+
cache: maven
26+
- name: Build with Maven
27+
run: mvn --batch-mode --update-snapshots package
28+
- name: Log in to the Container registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ github.actor }}
33+
password: ${{ secrets.GITHUB_TOKEN }}
34+
- name: Extract metadata (tags, labels) for Docker
35+
id: meta
36+
uses: docker/metadata-action@v5
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
- name: Build and push Docker image
40+
uses: docker/build-push-action@v5
41+
with:
42+
context: .
43+
push: true
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}

Dockerfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
FROM openjdk:11-jre
2-
WORKDIR /channelfinder
3-
ADD https://repo1.maven.org/maven2/org/phoebus/ChannelFinder/4.7.2/ChannelFinder-4.7.2.jar .
42

5-
CMD ["java", "-jar", "./ChannelFinder-*.jar", "--spring.config.name=application"]
3+
# deployment unit
4+
COPY target/ChannelFinder-*.jar /channelfinder/ChannelFinder-*.jar
65

6+
CMD ["java", "-jar", "/channelfinder/ChannelFinder-*.jar", "--spring.config.name=application"]

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ services:
1818
echo 'Waiting for Elasticsearch'
1919
sleep 1
2020
done
21-
java -jar /channelfinder/ChannelFinder-4.7.2.jar"
21+
java -jar /channelfinder/ChannelFinder-*.jar"
2222
2323
elasticsearch:
2424
image: docker.elastic.co/elasticsearch/elasticsearch:8.11.2

0 commit comments

Comments
 (0)