File tree Expand file tree Collapse file tree 4 files changed +121
-2
lines changed
Expand file tree Collapse file tree 4 files changed +121
-2
lines changed Original file line number Diff line number Diff line change 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 :
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 : .
Original file line number Diff line number Diff line change 1+ name : Build snapshot docker image
2+
3+ on :
4+ push :
5+ branches-ignore :
6+ - main
7+
8+ jobs :
9+ build-snapshot :
10+ runs-on : ubuntu-latest
11+ outputs :
12+ branch : ${{ steps.extract_branch.outputs.branch }}
13+ steps :
14+ - name : Extract branch name
15+ shell : bash
16+ run : echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >>$GITHUB_OUTPUT
17+ id : extract_branch
18+
19+ - uses : actions/checkout@v4
20+ with :
21+ ref : ${{ steps.extract_branch.outputs.branch }}
22+
23+ - name : Set up JDK 21
24+ uses : actions/setup-java@v4
25+ with :
26+ distribution : " temurin"
27+ java-version : " 21"
28+
29+ - name : Build API
30+ run : mvn package --no-transfer-progress
31+
32+ - name : Upload API jar
33+ uses : actions/upload-artifact@v4
34+ with :
35+ name : app-jar
36+ path : target/*.jar
37+
38+ docker :
39+ needs :
40+ - build-snapshot
41+ runs-on : ubuntu-latest
42+ steps :
43+ - uses : actions/checkout@v4
44+
45+ - name : Download uploaded jar
46+ uses : actions/download-artifact@v4
47+ with :
48+ name : app-jar
49+ path : target/
50+
51+ - name : Publish to Docker Hub
52+ uses : elgohr/Publish-Docker-Github-Action@v5
53+ with :
54+ name : inseefr/genesis-api
55+ username : ${{ secrets.DOCKERHUB_USERNAME }}
56+ password : ${{ secrets.DOCKERHUB_TOKEN }}
57+ tags : " snapshot-${{ needs.build-snapshot.outputs.branch }}"
58+ workdir : .
Original file line number Diff line number Diff line change 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" ]
Original file line number Diff line number Diff line change 44 <modelVersion >4.0.0</modelVersion >
55 <groupId >fr.insee.genesis</groupId >
66 <artifactId >genesis-api</artifactId >
7- <version >1.4.1 </version >
7+ <version >1.4.2 </version >
88 <packaging >jar</packaging >
99 <name >genesis-api</name >
1010
You can’t perform that action at this time.
0 commit comments