From da2fc7f7a3924e4835da52b599c16c6ca472a056 Mon Sep 17 00:00:00 2001 From: Kellegram Date: Wed, 9 Oct 2024 15:05:05 +0100 Subject: [PATCH 1/5] Add support for ARM --- .github/workflows/docker-publish.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index ff84412..82c7829 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -43,6 +43,9 @@ jobs: if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + # Set up BuildKit Docker container builder to be able to build # multi-platform images and export cache # https://github.com/docker/setup-buildx-action @@ -73,6 +76,7 @@ jobs: id: build-and-push uses: docker/build-push-action@v6 with: + platforms: linux/amd64,linux/arm64 context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} From 7df0ba9367d752f334ac3554ea8b307d51dc459d Mon Sep 17 00:00:00 2001 From: Kellegram Date: Wed, 9 Oct 2024 18:13:12 +0100 Subject: [PATCH 2/5] Comment the added QEMU section --- .github/workflows/docker-publish.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 82c7829..6979183 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -42,7 +42,9 @@ jobs: - name: Install cosign if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@v3 - + + # Setup QEMU to allow building multi-platform images + # https://docs.docker.com/build/ci/github-actions/multi-platform/ - name: Set up QEMU uses: docker/setup-qemu-action@v3 From 75a31935f1c766dcf78590375982145fbafe8f6f Mon Sep 17 00:00:00 2001 From: Kellegram Date: Fri, 11 Oct 2024 13:27:34 +0100 Subject: [PATCH 3/5] Revert adding QEMU --- .github/workflows/docker-publish.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 6979183..8698048 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -42,11 +42,6 @@ jobs: - name: Install cosign if: github.event_name != 'pull_request' uses: sigstore/cosign-installer@v3 - - # Setup QEMU to allow building multi-platform images - # https://docs.docker.com/build/ci/github-actions/multi-platform/ - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 # Set up BuildKit Docker container builder to be able to build # multi-platform images and export cache From 7ffdda7bbb6e1c62a643d3b27d188e1da8ba3e08 Mon Sep 17 00:00:00 2001 From: Kellegram Date: Fri, 11 Oct 2024 13:37:57 +0100 Subject: [PATCH 4/5] Download platform-specific rcon-cli --- Dockerfile | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a3a31d5..4bc7685 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,23 @@ FROM eclipse-temurin:17-jre-jammy AS builder RUN apt-get -qq update && apt-get -qq install -y unzip jq -RUN curl -fsSL -o "/tmp/rcon.tar.gz" $(curl -s https://api.github.com/repos/gorcon/rcon-cli/releases/latest | jq -r '.assets | map(select(.name | test("amd64_linux")))[0].browser_download_url') +# Set TARGETPLATFORM to be used for platform-specific downloads +ARG TARGETPLATFORM + +# Download the correct rcon-cli binary based on the TARGETPLATFORM +RUN case "$TARGETPLATFORM" in \ + "linux/amd64") \ + echo "Detected amd64"; \ + curl -fsSL -o "/tmp/rcon.tar.gz" $(curl -s https://api.github.com/repos/itzg/rcon-cli/releases/latest | jq -r '.assets | map(select(.name | test("linux_amd64")))[0].browser_download_url'); \ + ;; \ + "linux/arm64") \ + echo "Detected arm64"; \ + curl -fsSL -o "/tmp/rcon.tar.gz" $(curl -s https://api.github.com/repos/itzg/rcon-cli/releases/latest | jq -r '.assets | map(select(.name | test("linux_arm64")))[0].browser_download_url'); \ + ;; \ + *) echo "Unsupported platform: $TARGETPLATFORM"; exit 1 ;; \ + esac + + RUN mkdir /tmp/rcon RUN tar -xf /tmp/rcon.tar.gz -C /tmp/rcon --strip-components=1 From d61276864d4794d81b243b896d34804ff955eef1 Mon Sep 17 00:00:00 2001 From: Kellegram Date: Fri, 11 Oct 2024 16:40:17 +0100 Subject: [PATCH 5/5] Switch to using itzg rcon-cli --- Dockerfile | 9 +++++---- compose.yml | 1 + rcon | 4 ++-- rcon.yaml | 4 ++++ 4 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 rcon.yaml diff --git a/Dockerfile b/Dockerfile index 4bc7685..00de411 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,9 +17,11 @@ RUN case "$TARGETPLATFORM" in \ *) echo "Unsupported platform: $TARGETPLATFORM"; exit 1 ;; \ esac - RUN mkdir /tmp/rcon -RUN tar -xf /tmp/rcon.tar.gz -C /tmp/rcon --strip-components=1 +RUN tar -xf /tmp/rcon.tar.gz -C /tmp/rcon + + + WORKDIR /data RUN curl -fsSL -o "/tmp/pack.zip" "https://www.curseforge.com/api/v1/mods/681792/files/5795941/download" @@ -31,8 +33,7 @@ RUN cp /tmp/old/mods/Hephaestus-1.18.2-3.5.2.155.jar mods/ RUN curl -fsSL -o "server.jar" "https://meta.fabricmc.net/v2/versions/loader/1.18.2/0.16.3/0.11.1/server/jar" FROM eclipse-temurin:17-jre-jammy -COPY --from=builder --chmod=755 /tmp/rcon/rcon /usr/local/bin/rcon-cli -COPY --from=builder --chmod=644 /tmp/rcon/rcon.yaml /etc/rcon.yaml +COPY --from=builder --chmod=755 /tmp/rcon/rcon-cli /usr/local/bin/rcon-cli COPY --chmod=755 rcon /usr/local/bin/rcon COPY --chmod=755 entrypoint.sh /entrypoint.sh diff --git a/compose.yml b/compose.yml index 88255ce..7c93dcf 100644 --- a/compose.yml +++ b/compose.yml @@ -11,6 +11,7 @@ services: - ./banned-players.json:/data/banned-players.json:z - ./banned-ips.json:/data/banned-ips.json:z - ./server.properties:/init/server.properties:z + - ./rcon.yaml:/etc/rcon.yaml:z - astral-world:/data/world:z - astral-backup:/data/backup:z volumes: diff --git a/rcon b/rcon index 4bd96ce..136f19b 100755 --- a/rcon +++ b/rcon @@ -1,6 +1,6 @@ #!/bin/sh if [ -n "$RCON_PASSWORD" ]; then - rcon-cli -a "localhost:25575" -p "$RCON_PASSWORD" -c "/etc/rcon.yaml" "$@" + rcon-cli --host localhost --port 25575 --password "$RCON_PASSWORD" else - rcon-cli -a "localhost:25575" -c "/etc/rcon.yaml" "$@" + rcon-cli --config "/etc/rcon-cli.yaml" fi diff --git a/rcon.yaml b/rcon.yaml new file mode 100644 index 0000000..18a904b --- /dev/null +++ b/rcon.yaml @@ -0,0 +1,4 @@ +# Change these as needed for your configuration +host: localhost +port: 25575 +password: hunter2 \ No newline at end of file