Skip to content

Commit dc9f29d

Browse files
authored
Ghaction docker (#1)
* Docker build github action * Bump setup-java action version to avoid cache warning * Maven command typo * Adding node dir to gitignore * Adding node dir to gitignore
1 parent e667f25 commit dc9f29d

File tree

4 files changed

+70
-3
lines changed

4 files changed

+70
-3
lines changed

.github/workflows/docker-build.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Docker Build
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Linux GitHub CI"]
6+
types:
7+
- completed
8+
9+
jobs:
10+
build-docker:
11+
if: >
12+
github.event.workflow_run.conclusion == 'success' &&
13+
(github.event.workflow_run.head_branch == 'main' || github.event.workflow_run.head_branch == 'ghaction-docker')
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
packages: write
18+
steps:
19+
# The checkout action is required to access the repository files,
20+
# including the Dockerfile.
21+
# It needs to checkout the specific commit that triggered the 'Linux GitHub CI' workflow.
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
ref: ${{ github.event.workflow_run.head_sha }}
26+
27+
- name: Set up QEMU
28+
uses: docker/setup-qemu-action@v3
29+
30+
- name: Set up Docker Buildx
31+
uses: docker/setup-buildx-action@v3
32+
33+
- name: Login to GitHub Container Registry
34+
uses: docker/login-action@v3
35+
with:
36+
registry: ghcr.io
37+
username: ${{ github.actor }}
38+
password: ${{ secrets.GITHUB_TOKEN }}
39+
40+
- name: Build and push
41+
uses: docker/build-push-action@v5
42+
with:
43+
context: .
44+
file: ./docker/gn-image/Dockerfile
45+
push: true
46+
tags: ghcr.io/${{ github.repository }}/geonetwork:${{ github.event.workflow_run.head_branch }}

.github/workflows/linux.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
submodules: 'recursive'
2323
show-progress: 'false'
2424
- name: Set up JDK
25-
uses: actions/setup-java@v4.2.1
25+
uses: actions/setup-java@v5
2626
with:
2727
distribution: 'temurin'
2828
java-version: ${{ matrix.jdk }}
@@ -55,7 +55,7 @@ jobs:
5555
submodules: 'recursive'
5656
show-progress: 'false'
5757
- name: Set up JDK
58-
uses: actions/setup-java@v4.2.1
58+
uses: actions/setup-java@v5
5959
with:
6060
distribution: 'temurin'
6161
java-version: 11
@@ -67,7 +67,7 @@ jobs:
6767
- name: Test with maven
6868
run: |
6969
mvn -B resources:resources@copy-index-schema-to-source -f web
70-
mvn -B -ntp -V -fae verify -Drelesae -Pit
70+
mvn -B -ntp -V -fae verify -Drelease -Pit
7171
- name: Check for uncommitted changes such as formatting changes
7272
run: |
7373
if [[ -n "$(git status -s)" ]]; then

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ transifex/transifex-format/
4646
build/
4747
web-ui/LICENSE
4848
web-ui/tx
49+
plugins/datahub-integration/node/
4950

5051
# web-app, clear using: mvn -f web/pom.xml clean:clean@reset
5152

docker/gn-image/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Build stage
2+
FROM maven:3.8-jdk-11 AS builder
3+
4+
WORKDIR /usr/src/geonetwork
5+
6+
# Copy the entire project
7+
COPY . .
8+
9+
# Build the project and create the WAR file
10+
# The command is taken from the release-build.sh script
11+
RUN mvn clean install -DskipTests -ntp -Pwar -Pwro4j-prebuild-cache
12+
13+
# Runtime stage
14+
FROM jetty:9-jre11
15+
16+
# The geonetwork.war file is in web/target/
17+
COPY --from=builder /usr/src/geonetwork/web/target/geonetwork.war /var/lib/jetty/webapps/geonetwork.war
18+
19+
# Expose the default Jetty port
20+
EXPOSE 8080

0 commit comments

Comments
 (0)