From cab7ec34d2ef130877e834b54bdd1263975502bc Mon Sep 17 00:00:00 2001 From: Arindy Date: Tue, 11 Feb 2025 23:01:24 +0100 Subject: [PATCH 1/3] push to packages --- .github/workflows/ci.yaml | 9 ++++++++- compose.yml | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45cb98f..2dc71ad 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,6 +25,11 @@ jobs: run: | ./mvnw -B --no-transfer-progress versions:set -DremoveSnapshot + - name: docker login + run: | + docker login git.arindy.de + + - name: Build Runner run: | ./mvnw -B --no-transfer-progress clean verify -Pnative -Dquarkus.native.remote-container-build=true -Djgitver.skip=true @@ -45,7 +50,9 @@ jobs: - name: Build Container if: github.ref_name == 'main' - run: docker build -f src/main/docker/Dockerfile.native-micro -t ${{ env.REPO }} . + run: | + docker build -f src/main/docker/Dockerfile.native-micro -t git.arindy.de/arindy/dice-tower:latest -t git.arindy.de/arindy/dice-tower:${{ steps.version.outputs.VERSION }} . + docker push git.arindy.de/arindy/dice-tower:${{ steps.version.outputs.VERSION }} - name: Deploy if: github.ref_name == 'main' diff --git a/compose.yml b/compose.yml index d9c1c8a..2403b5f 100644 --- a/compose.yml +++ b/compose.yml @@ -1,7 +1,7 @@ services: api: container_name: dice-tower - image: dice-tower + image: git.arindy.de/arindy/dice-tower:latest restart: always networks: - reverse_proxy From 24acc0b9421c9d6eac6c7b639208934c4e05d2ed Mon Sep 17 00:00:00 2001 From: Arindy Date: Tue, 11 Feb 2025 23:11:06 +0100 Subject: [PATCH 2/3] push to packages --- .github/workflows/ci.yaml | 7 ++----- README.md | 25 +++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 2dc71ad..c3dac06 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -25,11 +25,6 @@ jobs: run: | ./mvnw -B --no-transfer-progress versions:set -DremoveSnapshot - - name: docker login - run: | - docker login git.arindy.de - - - name: Build Runner run: | ./mvnw -B --no-transfer-progress clean verify -Pnative -Dquarkus.native.remote-container-build=true -Djgitver.skip=true @@ -51,8 +46,10 @@ jobs: - name: Build Container if: github.ref_name == 'main' run: | + echo ${{secrets.PACKAGES_TOKEN}} | docker login --username ${{ secrets.PACKAGES_USER }} --password-stdin git.arindy.de docker build -f src/main/docker/Dockerfile.native-micro -t git.arindy.de/arindy/dice-tower:latest -t git.arindy.de/arindy/dice-tower:${{ steps.version.outputs.VERSION }} . docker push git.arindy.de/arindy/dice-tower:${{ steps.version.outputs.VERSION }} + docker push git.arindy.de/arindy/dice-tower:latest - name: Deploy if: github.ref_name == 'main' diff --git a/README.md b/README.md index e9550f3..678bae0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@

Key Features • - How To Build • + Start Container • + How To Build from scratchCreditsLicense

@@ -24,8 +25,28 @@ * Watch roll results (also available as Browser Source in OBS) --- +## Start Container -## How To Build +You can start dice-tower with docker compose + +Create a `compose.yml`-File with following content: +```yaml +services: + api: + container_name: dice-tower + image: git.arindy.de/arindy/dice-tower:latest + restart: always + ports: + - "8080:8080" +``` +Run the container with: +```bash +docker compose up -d +``` + +--- + +## How To Build from scratch To clone and run this application, you'll need `git`, `java21` and `docker`. From 4fd83f48cdd1b5e1ddb1a369d0c4947fcfd8ed02 Mon Sep 17 00:00:00 2001 From: Arindy Date: Tue, 11 Feb 2025 23:52:08 +0100 Subject: [PATCH 3/3] adds Version to index --- .../de/arindy/dicetower/IndexResource.kt | 35 +++++++++++++++++++ .../kotlin/de/arindy/dicetower/Templates.kt | 2 ++ .../resources/templates/{pub => }/index.html | 3 +- 3 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 src/main/kotlin/de/arindy/dicetower/IndexResource.kt rename src/main/resources/templates/{pub => }/index.html (99%) diff --git a/src/main/kotlin/de/arindy/dicetower/IndexResource.kt b/src/main/kotlin/de/arindy/dicetower/IndexResource.kt new file mode 100644 index 0000000..c30da0c --- /dev/null +++ b/src/main/kotlin/de/arindy/dicetower/IndexResource.kt @@ -0,0 +1,35 @@ +package de.arindy.dicetower + +import io.quarkus.qute.TemplateInstance +import io.quarkus.runtime.annotations.RegisterForReflection +import jakarta.enterprise.context.ApplicationScoped +import jakarta.ws.rs.Consumes +import jakarta.ws.rs.GET +import jakarta.ws.rs.POST +import jakarta.ws.rs.Path +import jakarta.ws.rs.PathParam +import jakarta.ws.rs.Produces +import jakarta.ws.rs.QueryParam +import jakarta.ws.rs.core.Context +import jakarta.ws.rs.core.MediaType +import jakarta.ws.rs.sse.OutboundSseEvent +import jakarta.ws.rs.sse.Sse +import jakarta.ws.rs.sse.SseBroadcaster +import jakarta.ws.rs.sse.SseEventSink +import org.eclipse.microprofile.config.inject.ConfigProperty +import java.util.UUID + +@Path("/") +@ApplicationScoped +final class IndexResource() { + + @ConfigProperty(name = "quarkus.application.version") + private lateinit var version: String + + @GET + @Produces(MediaType.TEXT_HTML) + fun get(): TemplateInstance { + return Templates.index(version) + } + +} diff --git a/src/main/kotlin/de/arindy/dicetower/Templates.kt b/src/main/kotlin/de/arindy/dicetower/Templates.kt index ef9a118..d21223f 100644 --- a/src/main/kotlin/de/arindy/dicetower/Templates.kt +++ b/src/main/kotlin/de/arindy/dicetower/Templates.kt @@ -9,4 +9,6 @@ object Templates { external fun overlay(diceid: String, scale: Int?, clearAfter: Long?): TemplateInstance @JvmStatic external fun results(room: String, name: String?, user: String?): TemplateInstance + @JvmStatic + external fun index(version: String): TemplateInstance } diff --git a/src/main/resources/templates/pub/index.html b/src/main/resources/templates/index.html similarity index 99% rename from src/main/resources/templates/pub/index.html rename to src/main/resources/templates/index.html index fba0e15..96261f0 100644 --- a/src/main/resources/templates/pub/index.html +++ b/src/main/resources/templates/index.html @@ -5,7 +5,7 @@ Dice-Tower - +