Skip to content

Commit 29ddcf1

Browse files
authored
Use maven github repo (#8)
* fix: migrate archiva to github * fix: prepare images * fix: war is stored in build * fix: update release
1 parent 97be9f5 commit 29ddcf1

9 files changed

Lines changed: 211 additions & 91 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
2+
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
3+
4+
name: Publish backend
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- uses: actions/checkout@v2
20+
- name: Set up JDK 8
21+
uses: actions/setup-java@v2
22+
with:
23+
java-version: '8'
24+
distribution: 'temurin'
25+
cache: maven
26+
27+
env:
28+
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Publish to GitHub Packages Apache Maven
32+
run: mvn --batch-mode deploy
33+
env:
34+
GITHUB_TOKEN: ${{ github.token }}

.github/workflows/backend.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Backend Java CI with Maven
5+
6+
on: [push, pull_request]
7+
env:
8+
IMAGE_NAME: wings
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 8
18+
uses: actions/setup-java@v2
19+
with:
20+
java-version: '8'
21+
distribution: 'temurin'
22+
cache: maven
23+
- name: Build with Maven
24+
run: mvn -B package --file pom.xml
25+
env:
26+
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- run: mkdir staging && cp server/target/*.war staging
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: Package
33+
path: staging
34+
35+
image:
36+
needs: [build]
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- uses: actions/download-artifact@v2
41+
with:
42+
name: Package
43+
path: build/
44+
45+
- name: Build image
46+
run: |
47+
docker build --tag $IMAGE_NAME -f docker/backend/Dockerfile .
48+
49+
- name: Login to DockerHub
50+
uses: docker/login-action@v1
51+
with:
52+
username: ${{ secrets.DOCKERHUB_USERNAME }}
53+
password: ${{ secrets.DOCKERHUB_TOKEN }}
54+
55+
- name: Push image
56+
run: |
57+
IMAGE_ID=ikcap/disk_backend
58+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
59+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
60+
[ "$VERSION" == "master" ] && VERSION=latest
61+
echo IMAGE_ID=$IMAGE_ID
62+
echo VERSION=$VERSION
63+
docker tag $IMAGE_NAME $IMAGE_ID:$GITHUB_SHA
64+
docker push $IMAGE_ID:$GITHUB_SHA
65+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
66+
docker push $IMAGE_ID:$VERSION

.github/workflows/build.yml

Lines changed: 0 additions & 62 deletions
This file was deleted.

.github/workflows/frontend.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
3+
4+
name: Frontend Java CI with Maven
5+
6+
on: [push, pull_request]
7+
env:
8+
IMAGE_NAME: wings
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Set up JDK 8
18+
uses: actions/setup-java@v2
19+
with:
20+
java-version: '8'
21+
distribution: 'temurin'
22+
cache: maven
23+
- name: Build with Maven
24+
run: mvn -B package --file pom.xml
25+
env:
26+
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- run: mkdir staging && cp client/target/*.war staging
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: Package
33+
path: staging
34+
35+
image:
36+
needs: [build]
37+
runs-on: ubuntu-latest
38+
steps:
39+
- uses: actions/checkout@v2
40+
- uses: actions/download-artifact@v2
41+
with:
42+
name: Package
43+
path: build/
44+
45+
- name: Build image
46+
run: |
47+
docker build --tag $IMAGE_NAME -f docker/frontend/Dockerfile .
48+
49+
- name: Login to DockerHub
50+
uses: docker/login-action@v1
51+
with:
52+
username: ${{ secrets.DOCKERHUB_USERNAME }}
53+
password: ${{ secrets.DOCKERHUB_TOKEN }}
54+
55+
- name: Push image
56+
run: |
57+
IMAGE_ID=ikcap/disk_frontend
58+
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
59+
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
60+
[ "$VERSION" == "master" ] && VERSION=latest
61+
echo IMAGE_ID=$IMAGE_ID
62+
echo VERSION=$VERSION
63+
docker tag $IMAGE_NAME $IMAGE_ID:$GITHUB_SHA
64+
docker push $IMAGE_ID:$GITHUB_SHA
65+
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
66+
docker push $IMAGE_ID:$VERSION

.release-it.json

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"git": {
3+
"changelog": "git log --pretty=format:\"* %s (%h)\" ${latestTag}...HEAD",
4+
"requireCleanWorkingDir": false,
5+
"requireUpstream": true,
6+
"addUntrackedFiles": true,
7+
"commit": true,
8+
"commitMessage": "Release ${version}",
9+
"commitArgs": "",
10+
"tag": true,
11+
"tagName": "${version}",
12+
"tagAnnotation": "Release ${version}",
13+
"tagArgs": "",
14+
"push": true,
15+
"pushArgs": "--follow-tags",
16+
"pushRepo": "origin"
17+
},
18+
"github": {
19+
"release": true
20+
},
21+
"hooks": {
22+
"after:bump": "mvn --settings pom.xml org.codehaus.mojo:versions-maven-plugin:2.1:set -DnewVersion=${version} 1>/dev/null 2>/dev/null"
23+
}
24+
}
25+

docker-compose.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: '3.9'
22

33
services:
44
frontend:
5-
image: ikcap/disk_frontend:i6
5+
image: ikcap/disk_frontend:latest
66
build:
77
context: .
88
dockerfile: docker/frontend/Dockerfile
@@ -12,7 +12,7 @@ services:
1212
- ./config.js:/usr/share/nginx/html/disk-portal/customize/config.js
1313
- ./docker/frontend/default.conf:/etc/nginx/conf.d/default.conf
1414
backend:
15-
image: ikcap/disk_backend:i6
15+
image: ikcap/disk_backend:latest
1616
build:
1717
context: .
1818
dockerfile: docker/backend/Dockerfile
@@ -21,12 +21,9 @@ services:
2121
volumes:
2222
- ./tomcat-users.xml:/usr/local/tomcat/conf/tomcat-users.xml
2323
- ./context.xml:/usr/local/tomcat/webapps/manager/META-INF/context.xml
24-
- ./server.properties:$HOME/.disk/server.properties
24+
- ./server.properties:/root/.disk/server.properties
2525
database:
2626
image: ikcap/disk_database
27-
build:
28-
context: ./database/
29-
dockerfile: Dockerfile
3027
restart: always
3128
env_file:
3229
- .env
@@ -36,12 +33,9 @@ services:
3633
image: ikcap/disk_wiki
3734
env_file:
3835
- .env
39-
build:
40-
context: ./wiki/
41-
dockerfile: Dockerfile
4236
restart: always
4337
ports:
44-
- 8080:80
38+
- 9080:80
4539
depends_on:
4640
- database
4741
endpoint:
@@ -53,7 +47,16 @@ services:
5347
- fuseki_databases:/fuseki-base/databases/
5448
env_file:
5549
- .env
50+
wings:
51+
image: "kcapd/wings-base:latest"
52+
environment:
53+
WINGS_MODE: dind
54+
volumes:
55+
- /var/run/docker.sock:/var/run/docker.sock
56+
ports:
57+
- 7080:8080
5658
volumes:
5759
mysql:
5860
fuseki_databases:
59-
fuseki_backups:
61+
fuseki_backups:
62+
wings:

docker/backend/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,5 @@
1-
# syntax=docker/dockerfile:1
2-
FROM maven:3.8.4-jdk-8 AS build
3-
WORKDIR /home/app/
4-
COPY . /home/app/
5-
RUN mvn -q -f /home/app/pom.xml package
6-
71
FROM tomcat:8.5.32
82
LABEL author="Maximiliano Osorio <mosorio@isi.edu>" \
93
maintainer="Maximiliano Osorio <mosorio@isi.edu>"
10-
COPY --from=build /home/app/server/target/*.war /usr/local/tomcat/webapps/disk-server.war
4+
COPY build/disk-project*.war /usr/local/tomcat/webapps/disk-server.war
115
COPY server.properties /root/.disk/server.properties

docker/frontend/Dockerfile

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,8 @@
11
# syntax=docker/dockerfile:1
2-
FROM maven:3.8.4-jdk-8 AS build
3-
WORKDIR /home/app/
4-
COPY . /home/app/
5-
RUN mvn -q -f /home/app/pom.xml package
6-
72
FROM nginx
8-
93
RUN apt-get update \
104
&& apt-get install -yq unzip
11-
COPY --from=build /home/app/client/target/*.war /tmp/disk-portal.war
5+
COPY build/disk-project-*.war /tmp/disk-portal.war
126
WORKDIR /usr/share/nginx/html
137
RUN mkdir disk-portal \
148
&& cd disk-portal \

server/pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<jackson.version>2.4.6</jackson.version>
2323
<gson.version>2.6.2</gson.version>
2424
<commons-configuration.version>1.10</commons-configuration.version>
25-
<ontapi.version>1.2.2</ontapi.version>
25+
<ontapi.version>1.2.4</ontapi.version>
2626
<jbcrypt.version>0.3m</jbcrypt.version>
2727
<java.version>1.8</java.version>
2828
<httpclient.version>4.5.2</httpclient.version>
@@ -31,10 +31,10 @@
3131
</properties>
3232

3333
<repositories>
34-
<!-- Local Wings Repository (for wings-ontapi & dependencies) -->
3534
<repository>
36-
<id>Local archiva.snapshots repository</id>
37-
<url>https://www.wings-workflows.org/archiva/repository/internal/</url>
35+
<id>github</id>
36+
<name>Github</name>
37+
<url>https://maven.pkg.github.com/KnowledgeCaptureAndDiscovery/ontapi</url>
3838
</repository>
3939
</repositories>
4040

0 commit comments

Comments
 (0)