diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index ff84412..8698048 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -73,6 +73,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 }} diff --git a/Dockerfile b/Dockerfile index a3a31d5..00de411 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,9 +1,27 @@ 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 +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" @@ -15,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