Skip to content

Commit aa0df8d

Browse files
committed
Adding Dockerfile and workflow
1 parent be20e26 commit aa0df8d

File tree

4 files changed

+67
-2
lines changed

4 files changed

+67
-2
lines changed

.github/workflows/maven.yaml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [ "main", "master" ]
6+
pull_request:
7+
branches: [ "main", "master" ]
8+
release:
9+
types: [ released ]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Login to GitHub Container Registry
20+
uses: docker/login-action@v3
21+
with:
22+
registry: ghcr.io
23+
username: ${{ github.actor }}
24+
password: ${{ secrets.GITHUB_TOKEN }}
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Set up JDK
33+
uses: actions/setup-java@v4
34+
with:
35+
java-version: '21'
36+
distribution: corretto
37+
cache: maven
38+
39+
- name: Build with Maven
40+
run: mvn -B --no-transfer-progress clean package
41+
42+
- name: Upload artifact [uber-jar]
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: uber-jar
46+
path: target/*-jar-with-dependencies.jar
47+
if-no-files-found: error
48+
retention-days: 7
49+
50+
- name: Build and push docker image [edge]
51+
run: docker buildx build --push -t ghcr.io/${{ github.repository }}:edge --platform linux/amd64,linux/arm64 .

Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Fetch the application jar from the target directory and rename it to application.jar
2+
FROM amazoncorretto:21-al2023-headless AS fetch
3+
4+
COPY target /target
5+
RUN mv /target/*-with-dependencies.jar /target/application.jar
6+
7+
8+
# Actual image to run the application
9+
FROM amazoncorretto:21-al2023-headless
10+
11+
EXPOSE 8082
12+
13+
COPY --from=fetch /target/application.jar /work/application.jar
14+
15+
CMD ["java", "-jar", "/work/application.jar"]

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ serverPort=<Pick a free port for example 8081>
3838
3939
From project root:
4040
```shell
41-
mvn clean install
41+
mvn clean package
4242
java -jar target/cake-redux-0.1-SNAPSHOT-jar-with-dependencies.jar <config file location>
4343
```
4444

src/test/java/no/javazone/cake/redux/AcceptorSetterTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ public void shouldHandleOtherValues() throws Exception {
3636

3737
@Test
3838
public void shouldHandleSlot() throws Exception {
39-
JsonObject roomObj = JsonParser.parseToObject("{\"ref\":\"dgdg\",\"name\":\"Room 5\"}");
4039
JsonObject slotObj = JsonParser.parseToObject("{\"ref\":\"dgdg\",\"start\":\"2017-09-07T13:00\",\"end\":\"2017-09-07T13:20\"}");
4140
JsonObject jsonTalk = JsonFactory.jsonObject().put("slot",slotObj);
4241
String message = acceptorSetter.generateMessage("This is #slot# hoi", null, null, null, null, null, jsonTalk, encodedTalkRef);

0 commit comments

Comments
 (0)