Merge pull request #186 from tawoe/container1

Container1
This commit is contained in:
Hongwei 2022-05-19 11:13:42 +02:00 committed by GitHub
commit 47147cbabd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 43 additions and 13 deletions

5
.github/Dockerfile_PreBuild vendored Normal file
View File

@ -0,0 +1,5 @@
FROM jetty:9.4-jre11-slim
# Copy OBP source code
# Copy build artifact (.war file) into jetty from 'maven' stage.
COPY /target/API_Explorer-1.0.war /var/lib/jetty/webapps/ROOT.war

34
.github/workflows/build_package.yml vendored Normal file
View File

@ -0,0 +1,34 @@
name: build and publish container
on: [push]
env:
## Sets environment variable
DOCKER_HUB_ORGANIZATION: openbankproject
DOCKER_HUB_REPOSITORY: api-explorer
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'
cache: maven
- name: Build with Maven
run: |
MAVEN_OPTS="-Xmx3G -Xss2m" mvn package
- name: Build the Docker image
run: |
echo "${{ secrets.DOCKER_HUB_TOKEN }}" | docker login -u "${{ secrets.DOCKER_HUB_USERNAME }}" --password-stdin docker.io
docker build . --file .github/Dockerfile_PreBuild --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:$GITHUB_SHA --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:latest --tag docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }}:develop
docker push docker.io/${{ env.DOCKER_HUB_ORGANIZATION }}/${{ env.DOCKER_HUB_REPOSITORY }} --all-tags
echo docker done

17
pom.xml
View File

@ -229,7 +229,7 @@
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.2.2</version>
<version>4.3.1</version>
<configuration>
<charset>${project.build.sourceEncoding}</charset>
<jvmArgs>
@ -239,7 +239,6 @@
<scalaCompatVersion>${scala.version}</scalaCompatVersion>
<scalaVersion>${scala.compiler}</scalaVersion>
<recompileMode>incremental</recompileMode>
<useZincServer>true</useZincServer>
</configuration>
<executions>
<execution>
@ -350,7 +349,7 @@
<plugin>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
<version>2.2.1</version>
<version>4.9.10</version>
<executions>
<execution>
<goals>
@ -370,16 +369,8 @@
<reporting>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>3.2.2</version>
<configuration>
<charset>${project.build.sourceEncoding}</charset>
<jvmArgs>
<jvmArg>-Xmx1024m</jvmArg>
<jvmArg>-DpackageLinkDefs=file://${project.build.directory}/packageLinkDefs.properties</jvmArg>
</jvmArgs>
</configuration>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
</plugin>
</plugins>
</reporting>