diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml new file mode 100644 index 0000000..bbd7f74 --- /dev/null +++ b/.github/workflows/master.yml @@ -0,0 +1,69 @@ +name: Build (master) + +on: + push: + branches: + - master + tags-ignore: + - '**' + release: + types: [ published ] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: ./mvnw -B package --file pom.xml + - uses: actions/cache@v2 + id: target-cache + with: + path: ./target/* + key: ${{ github.sha }} + + build_and_publish_docker_image: + name: Build and Publish Docker Image + runs-on: ubuntu-latest + needs: [ build ] + steps: + - uses: actions/checkout@v3 + - uses: actions/cache@v2 + id: target-cache + with: + path: ./target/* + key: ${{ github.sha }} + - name: Log in to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Get Project Version from POM + id: project-version + uses: CptMokoena/maven-get-version-action@1.0.3 + - name: Build and Push (latest) + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + uses: docker/build-push-action@v5 + with: + context: . + file: ./src/main/resources/Dockerfile + build-args: | + JAR_FILE=self-information-${{ steps.project-version.outputs.version }}.jar + push: true + tags: stefankapferer/ost-self-information-app:latest + - name: Build and Push (latest) + if: github.event_name == 'release' + uses: docker/build-push-action@v5 + with: + context: . + file: ./src/main/resources/Dockerfile + build-args: | + JAR_FILE=self-information-${{ steps.project-version.outputs.version }}.jar + push: true + tags: stefankapferer/ost-self-information-app:${{ github.event.release.tag_name }} \ No newline at end of file diff --git a/.github/workflows/standard.yml b/.github/workflows/standard.yml new file mode 100644 index 0000000..a02c776 --- /dev/null +++ b/.github/workflows/standard.yml @@ -0,0 +1,21 @@ +name: Build (non-master branch) + +on: + push: + branches-ignore: + - master + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: '17' + distribution: 'temurin' + cache: maven + - name: Build with Maven + run: ./mvnw -B package --file pom.xml diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 687668b..2f9352f 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -14,5 +14,5 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.1.1/maven-wrapper-3.1.1.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.6/apache-maven-3.9.6-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/org/apache/maven/wrapper/maven-wrapper/3.2.0/maven-wrapper-3.2.0.jar diff --git a/pom.xml b/pom.xml index 16aca80..b6d862b 100644 --- a/pom.xml +++ b/pom.xml @@ -6,12 +6,12 @@ org.springframework.boot spring-boot-starter-parent - 2.6.3 + 2.7.18 ch.ost.cloudsolutions self-information - 0.0.1-SNAPSHOT + 0.0.2--SNAPSHOT self-information Demo project for Spring Boot @@ -31,7 +31,7 @@ org.webjars bootstrap - 5.1.1 + 5.3.2 org.springframework.boot diff --git a/src/main/resources/Dockerfile b/src/main/resources/Dockerfile new file mode 100644 index 0000000..9c1607d --- /dev/null +++ b/src/main/resources/Dockerfile @@ -0,0 +1,14 @@ +FROM openjdk:17-slim-buster + +# add JAR file +ARG JAR_FILE +ADD target/${JAR_FILE} /srv/web/lib/self-information-app.jar + +RUN mkdir /srv/web/tmp +RUN mkdir /srv/web/conf + +ENV DEBUG_OPTS="" +ENV JAVA_OPTS="" + +EXPOSE 8080 +ENTRYPOINT exec java $DEBUG_OPTS $JAVA_OPTS -jar /srv/web/lib/self-information-app.jar --debug diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index 37a796d..378eeb3 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -4,7 +4,7 @@ Self Information Demo + th:href="@{/webjars/bootstrap/5.3.2/css/bootstrap.min.css}" />