diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 45cb98f..c3dac06 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -45,7 +45,11 @@ jobs: - name: Build Container if: github.ref_name == 'main' - run: docker build -f src/main/docker/Dockerfile.native-micro -t ${{ env.REPO }} . + 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 scratch • Credits • License
@@ -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`. 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 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 @@