Skip to content

Commit 95b3b28

Browse files
committed
feat: add docker images for genesis
1 parent 10fc979 commit 95b3b28

File tree

2 files changed

+62
-1
lines changed

2 files changed

+62
-1
lines changed

.github/workflows/create-release.yaml

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,28 @@ jobs:
4747
else
4848
echo "should_continue=true" >> $GITHUB_OUTPUT
4949
fi
50+
build-sources:
51+
needs: check-version
52+
runs-on: ubuntu-latest
53+
steps:
54+
- name: Set up JDK 21
55+
uses: actions/setup-java@v4
56+
with:
57+
distribution: 'temurin'
58+
java-version: '21'
59+
60+
- uses: actions/checkout@v4
61+
- name: Build app
62+
run: mvn package --no-transfer-progress
63+
64+
- name: Upload app jar
65+
uses: actions/upload-artifact@v4
66+
with:
67+
name: app-jar
68+
path: target/*.jar
5069

5170
create-release:
52-
needs: [ check-version ]
71+
needs: [ check-version, build-sources ]
5372
if: needs.check-version.outputs.should_run_next_job == 'true'
5473
runs-on: ubuntu-latest
5574
steps:
@@ -80,3 +99,25 @@ jobs:
8099
body: ${{steps.changeLogContent.outputs.changes}}
81100
env:
82101
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
102+
103+
publish-docker:
104+
needs: [ check-version, create-release ]
105+
runs-on: ubuntu-latest
106+
steps:
107+
- uses: actions/checkout@v4
108+
109+
- name: Download uploaded jar
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: app-jar
113+
path: target/
114+
115+
- name: Publish to Docker Hub
116+
uses: elgohr/Publish-Docker-Github-Action@v5
117+
with:
118+
name: inseefr/genesis-api
119+
username: ${{ secrets.DOCKERHUB_USERNAME }}
120+
password: ${{ secrets.DOCKERHUB_TOKEN }}
121+
default_branch: ${{ github.ref }}
122+
tags: ${{ needs.check-version.outputs.release-tag }}
123+
workdir: .

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM eclipse-temurin:21.0.5_11-jre-alpine
2+
3+
ENV PATH_TO_JAR=/opt/app/app.jar
4+
WORKDIR /opt/app/
5+
COPY ./target/*.jar $PATH_TO_JAR
6+
7+
ENV JAVA_TOOL_OPTIONS_DEFAULT \
8+
-XX:MaxRAMPercentage=75
9+
10+
# Setup a non-root user context (security)
11+
RUN addgroup -g 1000 tomcatgroup
12+
RUN adduser -D -s / -u 1000 tomcatuser -G tomcatgroup
13+
RUN mkdir /opt/app/temp-files
14+
RUN chown -R 1000:1000 /opt/app
15+
16+
USER 1000
17+
18+
ENTRYPOINT [ "/bin/sh", "-c", \
19+
"export JAVA_TOOL_OPTIONS=\"$JAVA_TOOL_OPTIONS_DEFAULT $JAVA_TOOL_OPTIONS\"; \
20+
exec java -jar $PATH_TO_JAR" ]

0 commit comments

Comments
 (0)