Skip to content

Commit cf51459

Browse files
committed
Containerization and Push to Dockerhub
1 parent bd3f5fe commit cf51459

File tree

6 files changed

+76
-25
lines changed

6 files changed

+76
-25
lines changed

.github/workflows/maven-pr-checks.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Java Compile and Test
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- master
7+
paths:
8+
- '!**.md'
9+
jobs:
10+
build:
11+
runs-on: ubuntu-18.04
12+
13+
steps:
14+
- uses: actions/checkout@v1
15+
- name: Set up JDK 1.8
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 1.8
19+
- name: Build with Maven
20+
run: mvn test --file pom.xml
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Release Snapshot
2+
3+
on:
4+
push:
5+
paths:
6+
- '!README.md'
7+
- '!AuditRules.md'
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-18.04
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- name: Set up JDK 1.8
18+
uses: actions/setup-java@v1
19+
with:
20+
java-version: 1.8
21+
- name: Release to snapshots repository
22+
run: mvn deploy -q --file pom.xml --settings src/devops/.travis.settings.xml -Denv.OSSRH_USERNAME=${{ secrets.OSSRH_USERNAME }} -Denv.OSSRH_PASSWORD=${{ secrets.OSSRH_PASSWORD }}

.travis.yml

+10-4
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
language: java
22
jdk:
33
- openjdk8
4+
services:
5+
- docker
46

57
branches:
68
only:
7-
- master
8-
- gerrit-integration
99
- "/^v[0-9]+\\.[0-9]+\\.[0-9]+.*$/"
1010

1111
install: true
@@ -14,9 +14,15 @@ before_script:
1414
- sudo chown -R $USER:$GROUP $TRAVIS_BUILD_DIR
1515

1616
script:
17-
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then mvn clean install -q; fi
18-
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [ "$TRAVIS_BRANCH" = "master" ]; then cp ./src/devops/deploy-snapshot.sh . && ./deploy-snapshot.sh; fi
1917
- if [ "$TRAVIS_PULL_REQUEST" = "false" ] && [[ "$TRAVIS_BRANCH" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then cp ./src/devops/release.sh . && ./release.sh; fi
18+
- export TAG=$TRAVIS_BRANCH
19+
- export IMAGE_NAME='hygieiadoc/apiaudit'
20+
- echo $IMAGE_NAME
21+
- echo $TAG
22+
- docker build -t $IMAGE_NAME .
23+
- docker tag $IMAGE_NAME $IMAGE_NAME:$TAG
24+
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
25+
- docker push $IMAGE_NAME
2026

2127
notifications:
2228
webhooks:

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ VOLUME ["/hygieia/logs"]
44

55
RUN mkdir /hygieia/config
66

7-
EXPOSE 8080
7+
EXPOSE 8081
88

99
ENV PROP_FILE /hygieia/config/application.properties
1010

1111
WORKDIR /hygieia
1212

13-
COPY target/*.jar /hygieia
13+
COPY target/*.jar /hygieia/
1414
COPY docker/properties-builder.sh /hygieia/
1515

1616
CMD ./properties-builder.sh &&\

docker/Dockerfile

-19
This file was deleted.

settings-github.xml

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
6+
<servers>
7+
<server>
8+
<id>ossrh</id>
9+
<username>${env.OSSRH_USERNAME}</username>
10+
<password>${env.OSSRH_PASSWORD}</password>
11+
</server>
12+
</servers>
13+
<profiles>
14+
<profile>
15+
<id>release</id>
16+
<properties>
17+
<gpg.keyname>${env.GPG_KEYNAME}}</gpg.keyname>
18+
<gpg.passphrase>${env.GPG_PASSPHRASE}</gpg.passphrase>
19+
</properties>
20+
</profile>
21+
</profiles>
22+
</settings>

0 commit comments

Comments
 (0)