Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft: Add support for ARM #10

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
25 changes: 21 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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

Expand Down
1 change: 1 addition & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions rcon
Original file line number Diff line number Diff line change
@@ -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
4 changes: 4 additions & 0 deletions rcon.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Change these as needed for your configuration
host: localhost
port: 25575
password: hunter2