Compare commits
19
Commits
344fd66deb
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1adf0ae0cd | ||
|
|
f1fb1b63b2 | ||
|
|
850efbc564 | ||
|
|
401f91fb12 | ||
|
|
e21312655f | ||
|
|
9caaae4950 | ||
|
|
d9e68a6941 | ||
|
|
4ade96312b | ||
|
|
fc2454d208 | ||
|
|
6cc16c40af | ||
|
|
6024242862 | ||
|
|
56e335f883 | ||
|
|
fbd61c3666 | ||
|
|
d795cc31b3 | ||
|
|
b9de96d39b | ||
|
|
df0eb1245b | ||
|
|
8c4f634aaf | ||
|
|
3c77c717aa | ||
|
|
d537983c23 |
No files matched your search
@@ -0,0 +1,39 @@
|
|||||||
|
name: Build FEX Bedrock Stack
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: "0 4 * * 1"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: [docker]
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install docker CLI
|
||||||
|
run: |
|
||||||
|
apt-get update -qq && apt-get install -y -qq docker.io >/dev/null
|
||||||
|
|
||||||
|
- name: "Build image (cache-busted: fresh FEX PPA + fresh Ubuntu rootfs)"
|
||||||
|
run: |
|
||||||
|
docker pull ubuntu:24.04
|
||||||
|
DOCKER_BUILDKIT=1 docker build --build-arg EMULATOR=fex --build-arg CACHE_BUST=$(date +%s) \
|
||||||
|
-t git.niklashmotion.art/hermes/fex-bedrock-vanilla:latest \
|
||||||
|
-t git.niklashmotion.art/hermes/fex-bedrock-vanilla:$(date +%Y%m%d) .
|
||||||
|
|
||||||
|
- name: Push to Gitea Registry
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.REGISTRY_TOKEN }}" | docker login git.niklashmotion.art -u Hermes --password-stdin
|
||||||
|
docker push --all-tags git.niklashmotion.art/hermes/fex-bedrock-vanilla
|
||||||
|
docker logout git.niklashmotion.art
|
||||||
|
|
||||||
|
- name: Sync local tag (no container restart)
|
||||||
|
run: |
|
||||||
|
docker pull git.niklashmotion.art/hermes/fex-bedrock-vanilla:latest
|
||||||
|
docker tag git.niklashmotion.art/hermes/fex-bedrock-vanilla:latest fex-bedrock-vanilla:latest
|
||||||
|
# Legacy-Alias fuer Bestandscontainer/BSM-Eintraege (entfernen, sobald niemand mehr den alten Namen nutzt)
|
||||||
|
docker tag git.niklashmotion.art/hermes/fex-bedrock-vanilla:latest fex-bedrock-stack:latest
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
run: docker image prune -f
|
||||||
+9
-6
@@ -1,4 +1,4 @@
|
|||||||
FROM debian
|
FROM ubuntu:24.04
|
||||||
|
|
||||||
# hook into docker BuildKit --platform support
|
# hook into docker BuildKit --platform support
|
||||||
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
|
||||||
@@ -8,8 +8,11 @@ ARG TARGETVARIANT
|
|||||||
|
|
||||||
RUN --mount=target=/build,source=build /build/install-packages
|
RUN --mount=target=/build,source=build /build/install-packages
|
||||||
|
|
||||||
|
ARG EMULATOR=fex
|
||||||
ARG BOX64_PACKAGE=box64
|
ARG BOX64_PACKAGE=box64
|
||||||
RUN --mount=target=/build,source=build BOX64_PACKAGE=$BOX64_PACKAGE /build/setup-arm64
|
# Cache-bust: force fresh FEX PPA + rootfs download on each pipeline run
|
||||||
|
ARG CACHE_BUST=0
|
||||||
|
RUN --mount=target=/build,source=build EMULATOR=$EMULATOR BOX64_PACKAGE=$BOX64_PACKAGE /build/setup-arm64
|
||||||
|
|
||||||
EXPOSE 19132/tcp
|
EXPOSE 19132/tcp
|
||||||
EXPOSE 19132/udp
|
EXPOSE 19132/udp
|
||||||
@@ -28,11 +31,11 @@ ARG APPS_REV=1
|
|||||||
ARG GITHUB_BASEURL=https://github.com
|
ARG GITHUB_BASEURL=https://github.com
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/easy-add
|
# renovate: datasource=github-releases packageName=itzg/easy-add
|
||||||
ARG EASY_ADD_VERSION=0.8.17
|
ARG EASY_ADD_VERSION=0.8.19
|
||||||
ADD --chmod=755 ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
ADD --chmod=755 ${GITHUB_BASEURL}/itzg/easy-add/releases/download/${EASY_ADD_VERSION}/easy-add_${TARGETOS}_${TARGETARCH}${TARGETVARIANT} /usr/bin/easy-add
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/entrypoint-demoter
|
# renovate: datasource=github-releases packageName=itzg/entrypoint-demoter
|
||||||
ARG ENTRYPOINT_DEMOTER_VERSION=0.5.1
|
ARG ENTRYPOINT_DEMOTER_VERSION=0.5.3
|
||||||
RUN easy-add --var version=${ENTRYPOINT_DEMOTER_VERSION} --var app=entrypoint-demoter --file {{.app}} --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/v{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz
|
RUN easy-add --var version=${ENTRYPOINT_DEMOTER_VERSION} --var app=entrypoint-demoter --file {{.app}} --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/v{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/set-property
|
# renovate: datasource=github-releases packageName=itzg/set-property
|
||||||
@@ -40,13 +43,13 @@ ARG SET_PROPERTY_VERSION=0.1.6
|
|||||||
RUN easy-add --var version=${SET_PROPERTY_VERSION} --var app=set-property --file {{.app}} --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz
|
RUN easy-add --var version=${SET_PROPERTY_VERSION} --var app=set-property --file {{.app}} --from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/mc-monitor
|
# renovate: datasource=github-releases packageName=itzg/mc-monitor
|
||||||
ARG MC_MONITOR_VERSION=1.18.2
|
ARG MC_MONITOR_VERSION=1.19.0
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
--var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \
|
--var version=${MC_MONITOR_VERSION} --var app=mc-monitor --file {{.app}} \
|
||||||
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|
||||||
# renovate: datasource=github-releases packageName=itzg/mc-server-runner
|
# renovate: datasource=github-releases packageName=itzg/mc-server-runner
|
||||||
ARG MC_SERVER_RUNNER_VERSION=1.16.0
|
ARG MC_SERVER_RUNNER_VERSION=1.16.2
|
||||||
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
RUN easy-add --var os=${TARGETOS} --var arch=${TARGETARCH}${TARGETVARIANT} \
|
||||||
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
|
--var version=${MC_SERVER_RUNNER_VERSION} --var app=mc-server-runner --file {{.app}} \
|
||||||
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
--from ${GITHUB_BASEURL}/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_{{.os}}_{{.arch}}.tar.gz
|
||||||
|
|||||||
@@ -9,7 +9,8 @@
|
|||||||
Bedrock Dedicated Server (BDS) version 1.26.50 and later uses the newer NetherNet transport by default.
|
Bedrock Dedicated Server (BDS) version 1.26.50 and later uses the newer NetherNet transport by default.
|
||||||
Clients connect to TCP port 19132 first. Then each client uses a UDP port for gameplay.
|
Clients connect to TCP port 19132 first. Then each client uses a UDP port for gameplay.
|
||||||
|
|
||||||
The following starts a server on a LAN. Replace `192.168.1.10` with the IP address of the Docker host:
|
The following starts a server on a LAN. Replace `192.168.1.10` with the IP address of the Docker host.
|
||||||
|
Alternatively, you can use `<public_ip>` in place of an ip address to resolve to your public ip at startup.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run -d -it -e EULA=TRUE \
|
docker run -d -it -e EULA=TRUE \
|
||||||
@@ -190,14 +191,43 @@ During the handshake, BDS sends the client a list of addresses and UDP ports. Th
|
|||||||
|
|
||||||
- With `network_mode: host`, BDS sends the addresses of the host. Set only the port range, for example `SERVER_UDP_PORTS: "19140-19155"`.
|
- With `network_mode: host`, BDS sends the addresses of the host. Set only the port range, for example `SERVER_UDP_PORTS: "19140-19155"`.
|
||||||
- With a Docker bridge network, rootless networking or NAT, BDS can send addresses that the client cannot reach. Set the address that clients use, for example `SERVER_UDP_PORTS: "192.168.1.10:19140-19155:19140-19155"`.
|
- With a Docker bridge network, rootless networking or NAT, BDS can send addresses that the client cannot reach. Set the address that clients use, for example `SERVER_UDP_PORTS: "192.168.1.10:19140-19155:19140-19155"`.
|
||||||
|
- IMPORTANT: to access over the internet you need to use the public ip in the `SERVER_UDP_PORTS`, and forward all the ports.
|
||||||
|
|
||||||
Use an IPv4 or IPv6 literal, not a hostname.
|
Use an IPv4 or IPv6 literal, not a hostname.
|
||||||
To use the public IP address of the host, use the literal string `<public_ip>`. At startup, the image replaces it with the result of `curl ifconfig.me`.
|
|
||||||
|
|
||||||
Use a range with at least one port for each player (`max-players`, default 10).
|
Use a range with at least one port for each player (`max-players`, default 10).
|
||||||
Publish the TCP port and the full UDP range.
|
Publish the TCP port and the full UDP range.
|
||||||
For an example, see [examples/nethernet/compose.yml](examples/nethernet/compose.yml).
|
For an example, see [examples/nethernet/compose.yml](examples/nethernet/compose.yml).
|
||||||
|
|
||||||
|
### Using placeholder for public IP
|
||||||
|
|
||||||
|
Use one of the following placeholders in `SERVER_UDP_PORTS` to have the container resolve your public IP at startup using https://www.ipify.org/:
|
||||||
|
- `<public_ip>` : resolves to either IPv4 or IPv6, whichever is resolved by the universal lookup
|
||||||
|
- `<public_ipv4>` : resolves to IPv4 only
|
||||||
|
- `<public_ipv6>` : resolves to IPv6 only
|
||||||
|
|
||||||
|
### From Mojang's docs regarding SERVER_UDP_PORTS
|
||||||
|
|
||||||
|
```
|
||||||
|
Configures UDP client transport ports.
|
||||||
|
This property is ignored when `transport=raknet`.
|
||||||
|
If not set, UDP ports are allocated from the operating system's ephemeral port range.
|
||||||
|
Two modes are supported:
|
||||||
|
1. Single UDP port shared by all clients.
|
||||||
|
2. UDP port range, where client connections are distributed across a range of ports but will reuse ports if the range is exhausted.
|
||||||
|
Both modes support either the same local and public port values or a public:local mapping. Ranges on each side of `:` must be the same length.
|
||||||
|
Optionally, specify the public IP address using IP:public:local (IPv4) or [IPv6]:public:local (IPv6).
|
||||||
|
Both port values are required with an IP prefix, even when they are the same.
|
||||||
|
Examples:
|
||||||
|
server-udp-ports=19489 (Single UDP port shared by all clients, local and public values are the same)
|
||||||
|
server-udp-ports=29489:19489 (Single UDP port shared by all clients, public port:29489 must map to local port:19489)
|
||||||
|
server-udp-ports=19400-19500 (UDP port range, local and public values are the same)
|
||||||
|
server-udp-ports=21200-21300:19400-19500 (UDP port range, public port range: 21200-21300 must map to local port range: 19400-19500)
|
||||||
|
server-udp-ports=12.19.20.18:19489:19489 (Single UDP port with public IP, 12.19.20.18:19489 must map to the server's local UDP port 19489)
|
||||||
|
server-udp-ports=[2001:db8::2021:26:03]:21200-21300:19400-19500
|
||||||
|
(UDP port range with public IP, [2001:db8::2021:26:03]:21200-21300 must map to the server's local UDP ports 19400-19500)
|
||||||
|
```
|
||||||
|
|
||||||
### Firewall
|
### Firewall
|
||||||
|
|
||||||
On the host firewall and on all network firewalls between the clients and the server, allow these inbound connections:
|
On the host firewall and on all network firewalls between the clients and the server, allow these inbound connections:
|
||||||
@@ -235,9 +265,8 @@ BDS 1.26.51 logs an error that NetherNet is the only supported transport.
|
|||||||
|
|
||||||
## IPv6 same-port fix
|
## IPv6 same-port fix
|
||||||
|
|
||||||
> **NOTE**: This fix applies only to `TRANSPORT=raknet`. Do not use it with NetherNet.
|
> **NOTE**: This fix is only needed with the legacy `TRANSPORT=raknet`. With NetherNet the shim is inert:
|
||||||
> The shim changes each IPv6 socket that binds to `SERVER_PORT_V6`, which includes the NetherNet TCP socket.
|
> it acts on UDP sockets only and leaves the NetherNet TCP socket untouched, so it can stay enabled.
|
||||||
> If `SERVER_PORT_V6` is equal to `SERVER_PORT`, the TCP socket becomes IPv6-only, and IPv4 clients cannot connect.
|
|
||||||
|
|
||||||
BDS binds IPv4 and IPv6 on separate ports by default (19132 and 19133).
|
BDS binds IPv4 and IPv6 on separate ports by default (19132 and 19133).
|
||||||
Bedrock clients do not implement Happy Eyeballs, so a player whose device
|
Bedrock clients do not implement Happy Eyeballs, so a player whose device
|
||||||
@@ -456,10 +485,12 @@ When finished, detach from the server console using Ctrl-p, Ctrl-q
|
|||||||
## Deploying with Docker Compose
|
## Deploying with Docker Compose
|
||||||
|
|
||||||
The [examples](examples) directory contains [an example Docker compose file](examples/docker-compose.yml) that declares:
|
The [examples](examples) directory contains [an example Docker compose file](examples/docker-compose.yml) that declares:
|
||||||
- a service running the bedrock server container and exposing TCP port 19132 and UDP ports 19140-19155 for NetherNet. In the example is named "bds", short for "Bedrock Dedicated Server", but you can name the service whatever you want
|
- A service running the bedrock server container. In the example is named "bds", short for "Bedrock Dedicated Server", but you can name the service whatever you want.
|
||||||
- a volume attached to the service at the container path `/data`
|
- The service exposes TCP port 19132 and UDP ports 19140-19155 for NetherNet. For more information, see [NetherNet](#nethernet).
|
||||||
|
- For LAN only: Replace `192.168.1.10` with the IP address of the Docker host.
|
||||||
Replace `192.168.1.10` with the IP address of the Docker host. For more information, see [NetherNet](#nethernet).
|
- For Internet: Replace `192.168.1.10` with a static public IP address, or `<public_ip>` to look up your current IP at startup.
|
||||||
|
- EULA must be true, other env variables can be defined to configure the server here as well.
|
||||||
|
- A volume attached to the service at the container path `/data`
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
services:
|
services:
|
||||||
@@ -468,6 +499,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
# NetherNet: replace 192.168.1.10 with the IP address of the Docker host
|
# NetherNet: replace 192.168.1.10 with the IP address of the Docker host
|
||||||
|
# If this server is meant to be accessible over the internet, and has a dynamic you
|
||||||
|
# can use "<public_ip>" in place of an ip address to resolve your public ip on startup
|
||||||
SERVER_UDP_PORTS: "192.168.1.10:19140-19155:19140-19155"
|
SERVER_UDP_PORTS: "192.168.1.10:19140-19155:19140-19155"
|
||||||
ports:
|
ports:
|
||||||
# Note the newer NetherNet protocol uses different ports to RakNet
|
# Note the newer NetherNet protocol uses different ports to RakNet
|
||||||
@@ -491,6 +524,15 @@ You can follow the logs at any time using:
|
|||||||
docker compose logs -f
|
docker compose logs -f
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Deploying with Easypanel
|
||||||
|
|
||||||
|
[Easypanel](https://easypanel.io) is a self-hosted Docker deployment platform, and this image has a one-click deployment template there (Minecraft Bedrock Server):
|
||||||
|
|
||||||
|
[![Deploy on Easypanel][easypanel-btn]][easypanel-deploy]
|
||||||
|
|
||||||
|
[easypanel-btn]: https://easypanel.io/img/deploy-on-easypanel-40.svg
|
||||||
|
[easypanel-deploy]: https://easypanel.io/templates/minecraft-server-bedrock
|
||||||
|
|
||||||
## Deploying with Kubernetes
|
## Deploying with Kubernetes
|
||||||
|
|
||||||
The [examples](examples) directory contains [an example Kubernetes manifest file](examples/kubernetes.yml) that declares:
|
The [examples](examples) directory contains [an example Kubernetes manifest file](examples/kubernetes.yml) that declares:
|
||||||
|
|||||||
+123
-48
@@ -21,13 +21,18 @@ function isTrue() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function logInfo() {
|
||||||
|
msg="${1?}"
|
||||||
|
echo "INFO $msg"
|
||||||
|
}
|
||||||
|
|
||||||
function logWarn() {
|
function logWarn() {
|
||||||
msg=${1?}
|
msg="${1?}"
|
||||||
echo "WARN $msg" >&2
|
echo "WARN $msg" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
function logError() {
|
function logError() {
|
||||||
msg=${1?}
|
msg="${1?}"
|
||||||
echo "ERROR $msg" >&2
|
echo "ERROR $msg" >&2
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -166,6 +171,102 @@ function extractVersionFromUrl() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isIPv6() {
|
||||||
|
ip=${1:?}
|
||||||
|
if [[ $ip =~ ^([0-9a-fA-F]{0,4}:){2,7}[0-9a-fA-F]{0,4}$ ]]; then
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function formatIpPart() {
|
||||||
|
ip=${1:?}
|
||||||
|
if isIPv6 "$ip"; then
|
||||||
|
echo "[$ip]"
|
||||||
|
else
|
||||||
|
echo "$ip"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
## @param placeholder The placeholder to replace (e.g., <public_ip>, <public_ipv4>, <public_ipv6>)
|
||||||
|
## @param publicIp The public IP address to replace the placeholder with. If empty, which will be the case if ipify is unable to resolve the requested address, the function will log an error and exit.
|
||||||
|
function replaceIpPlaceholder() {
|
||||||
|
local placeholder="${1:?}"
|
||||||
|
local publicIp="$2"
|
||||||
|
|
||||||
|
if [[ -z "$publicIp" ]]; then
|
||||||
|
logError "Unable to resolve public IP for ${placeholder}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
logInfo "Replacing ${placeholder} with ${publicIp} in SERVER_UDP_PORTS"
|
||||||
|
|
||||||
|
SERVER_UDP_PORTS="${SERVER_UDP_PORTS//${placeholder}/$(formatIpPart "$publicIp")}"
|
||||||
|
export SERVER_UDP_PORTS
|
||||||
|
}
|
||||||
|
|
||||||
|
## Evaluates the SERVER_UDP_PORTS environment variable and replaces the following placeholders:
|
||||||
|
## - <public_ip> with the public IP address (IPv4 or IPv6) of the server
|
||||||
|
## - <public_ipv4> with the public IPv4 address of the server
|
||||||
|
## - <public_ipv6> with the public IPv6 address of the server
|
||||||
|
## If one of the specific placeholders does not resolve, then the startup will exit
|
||||||
|
function manageServerUdpPorts() {
|
||||||
|
if [[ "$SERVER_UDP_PORTS" == *"<public_ip>"* ]]; then
|
||||||
|
replaceIpPlaceholder "<public_ip>" "$(curl -s https://api64.ipify.org)"
|
||||||
|
elif [[ "$SERVER_UDP_PORTS" == *"<public_ipv4>"* ]]; then
|
||||||
|
replaceIpPlaceholder "<public_ipv4>" "$(curl -s https://api.ipify.org)"
|
||||||
|
elif [[ "$SERVER_UDP_PORTS" == *"<public_ipv6>"* ]]; then
|
||||||
|
replaceIpPlaceholder "<public_ipv6>" "$(curl -s https://api6.ipify.org)"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
function manageProperties() {
|
||||||
|
manageServerUdpPorts
|
||||||
|
|
||||||
|
if [[ -n "$VARIABLES" ]]; then
|
||||||
|
echo "Setting variables"
|
||||||
|
mkdir -p config/default
|
||||||
|
|
||||||
|
# Try to parse VARIABLES as JSON
|
||||||
|
if echo "$VARIABLES" | jq empty >/dev/null 2>&1; then
|
||||||
|
# VARIABLES is valid JSON
|
||||||
|
echo "$VARIABLES" | jq '.' > "config/default/variables.json"
|
||||||
|
else
|
||||||
|
# VARIABLES is not valid JSON, attempt to parse as custom format
|
||||||
|
echo "VARIABLES is not valid JSON, attempting to parse as custom format"
|
||||||
|
|
||||||
|
# Parse the VARIABLES using custom format (key:value,key:value)
|
||||||
|
# Note: Values should not contain unescaped commas or colons
|
||||||
|
jq -n --arg vars "$VARIABLES" '
|
||||||
|
$vars
|
||||||
|
| split("[,\\n]+"; "")
|
||||||
|
| map(
|
||||||
|
select(length>0) |
|
||||||
|
split("=") as $kv |
|
||||||
|
{ ($kv[0]): ($kv[1] | fromjson? // $kv[1]) }
|
||||||
|
)
|
||||||
|
| add
|
||||||
|
' > "config/default/variables.json"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -f server.properties ]; then
|
||||||
|
# prevent issue with bind mounted server.properties which can not be moved (sed tries to move the file when '-i' is used)
|
||||||
|
_SERVER_PROPERTIES=$(sed '/^white-list=.*/d' server.properties) #Removes white-list= line from server.properties
|
||||||
|
echo "${_SERVER_PROPERTIES}" > server.properties
|
||||||
|
fi
|
||||||
|
export ALLOW_LIST
|
||||||
|
|
||||||
|
# update server.properties with environment settings
|
||||||
|
set-property --file server.properties --bulk /etc/bds-property-definitions.json
|
||||||
|
}
|
||||||
|
|
||||||
|
#######################################################################################################################
|
||||||
|
# MAIN
|
||||||
|
#######################################################################################################################
|
||||||
|
|
||||||
echo "Image info: $(paste -d, -s /etc/image.properties)"
|
echo "Image info: $(paste -d, -s /etc/image.properties)"
|
||||||
|
|
||||||
debugCurlArgs=()
|
debugCurlArgs=()
|
||||||
@@ -445,51 +546,7 @@ if [[ -n "$ALLOW_LIST_USERS" || -n "$WHITE_LIST_USERS" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ "$SERVER_UDP_PORTS" == *"<public_ip>"* ]]; then
|
manageProperties
|
||||||
echo "Replacing <public_ip> in $SERVER_UDP_PORTS"
|
|
||||||
public_ip=$(curl -s ifconfig.me)
|
|
||||||
echo "Public IP resolved to: $public_ip"
|
|
||||||
SERVER_UDP_PORTS="${SERVER_UDP_PORTS//<public_ip>/$public_ip}"
|
|
||||||
export SERVER_UDP_PORTS
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ -n "$VARIABLES" ]]; then
|
|
||||||
echo "Setting variables"
|
|
||||||
mkdir -p config/default
|
|
||||||
|
|
||||||
# Try to parse VARIABLES as JSON
|
|
||||||
if echo "$VARIABLES" | jq empty >/dev/null 2>&1; then
|
|
||||||
# VARIABLES is valid JSON
|
|
||||||
echo "$VARIABLES" | jq '.' > "config/default/variables.json"
|
|
||||||
else
|
|
||||||
# VARIABLES is not valid JSON, attempt to parse as custom format
|
|
||||||
echo "VARIABLES is not valid JSON, attempting to parse as custom format"
|
|
||||||
|
|
||||||
# Parse the VARIABLES using custom format (key:value,key:value)
|
|
||||||
# Note: Values should not contain unescaped commas or colons
|
|
||||||
jq -n --arg vars "$VARIABLES" '
|
|
||||||
$vars
|
|
||||||
| split("[,\\n]+"; "")
|
|
||||||
| map(
|
|
||||||
select(length>0) |
|
|
||||||
split("=") as $kv |
|
|
||||||
{ ($kv[0]): ($kv[1] | fromjson? // $kv[1]) }
|
|
||||||
)
|
|
||||||
| add
|
|
||||||
' > "config/default/variables.json"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ -f server.properties ]; then
|
|
||||||
# prevent issue with bind mounted server.properties which can not be moved (sed tries to move the file when '-i' is used)
|
|
||||||
_SERVER_PROPERTIES=$(sed '/^white-list=.*/d' server.properties) #Removes white-list= line from server.properties
|
|
||||||
echo "${_SERVER_PROPERTIES}" > server.properties
|
|
||||||
fi
|
|
||||||
export ALLOW_LIST
|
|
||||||
|
|
||||||
# update server.properties with environment settings
|
|
||||||
set-property --file server.properties --bulk /etc/bds-property-definitions.json
|
|
||||||
|
|
||||||
export LD_LIBRARY_PATH=.
|
export LD_LIBRARY_PATH=.
|
||||||
|
|
||||||
@@ -520,8 +577,26 @@ if isTrue "${ENABLE_SSH}"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Starting Bedrock server..."
|
echo "Starting Bedrock server..."
|
||||||
if [[ -f /usr/local/bin/box64 ]] && isTrue "${USE_BOX64}" ; then
|
if [[ -f /usr/local/bin/box64 ]] && isTrue "${USE_BOX64:=false}" ; then
|
||||||
exec mc-server-runner "${mcServerRunnerArgs[@]}" box64 ./"$SERVER"
|
exec mc-server-runner "${mcServerRunnerArgs[@]}" box64 ./"$SERVER"
|
||||||
|
elif [[ -x /usr/bin/FEX ]] && isTrue "${USE_FEX:=true}" ; then
|
||||||
|
# FEX-Emu (x86_64 on arm64): RootFS and emulator are baked into the image.
|
||||||
|
# FEX_EMU_DIR holds the JIT/AOT caches — keep it on a volume for warm starts.
|
||||||
|
# FEX >= 2611: unified launcher is /usr/bin/FEX (FEXInterpreter was removed).
|
||||||
|
export FEX_ROOTFS="${FEX_ROOTFS:-/opt/fex-emu-rootfs/rootfs}"
|
||||||
|
export FEX_EMU_DIR="${FEX_EMU_DIR:-$HOME/.fex-emu}"
|
||||||
|
mkdir -p "$FEX_EMU_DIR"
|
||||||
|
if [[ ! -f "$HOME/.config/fex-emu/Config.json" ]]; then
|
||||||
|
mkdir -p "$HOME/.config/fex-emu"
|
||||||
|
cat > "$HOME/.config/fex-emu/Config.json" << 'FEXCONF'
|
||||||
|
{
|
||||||
|
"Options": [
|
||||||
|
{ "Key": "RootFS", "Value": "/opt/fex-emu-rootfs/rootfs" }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
FEXCONF
|
||||||
|
fi
|
||||||
|
exec mc-server-runner "${mcServerRunnerArgs[@]}" /usr/bin/FEX ./"$SERVER"
|
||||||
else
|
else
|
||||||
exec mc-server-runner "${mcServerRunnerArgs[@]}" ./"$SERVER"
|
exec mc-server-runner "${mcServerRunnerArgs[@]}" ./"$SERVER"
|
||||||
fi
|
fi
|
||||||
+42
-4
@@ -2,8 +2,46 @@
|
|||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
if [ "$TARGETARCH" = "arm64" ] ; then
|
if [ "$TARGETARCH" != "arm64" ] ; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
EMULATOR="${EMULATOR:-fex}"
|
||||||
|
apt-get update
|
||||||
|
|
||||||
|
if [ "$EMULATOR" = "fex" ] ; then
|
||||||
|
# FEX-Emu: official PPA (arm64 builds), Ubuntu base required
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
|
software-properties-common \
|
||||||
|
squashfs-tools \
|
||||||
|
ca-certificates \
|
||||||
|
curl
|
||||||
|
|
||||||
|
add-apt-repository -y ppa:fex-emu/fex
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
|
# fex-emu is a virtual package; pick the explicit variant matching the CPU.
|
||||||
|
# RK3588 (Cortex-A76) has ARMv8.2 features; fall back to armv8.0.
|
||||||
|
FEX_PKG="fex-emu-armv8.2"
|
||||||
|
apt-get install -y --no-install-recommends "$FEX_PKG" || FEX_PKG="fex-emu-armv8.0"
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends "$FEX_PKG" libjemalloc2
|
||||||
|
|
||||||
|
# Thunks are optional but speed up glibc-heavy servers
|
||||||
|
DEBIAN_FRONTEND=noninteractive apt-get install -y fex-emu-thunks 2>/dev/null || true
|
||||||
|
|
||||||
|
# Bake the x86_64 RootFS into the image so the container is fully self-contained
|
||||||
|
# (no FEXRootFSFetcher at first start, no network needed at runtime)
|
||||||
|
ROOTFS_URL=$(curl -fsSL https://rootfs.fex-emu.gg/RootFS_links.json \
|
||||||
|
| python3 -c "import json,sys; d=json.load(sys.stdin)['v1']; print(d['Ubuntu 24.04 (SquashFS)']['URL'])")
|
||||||
|
echo "Fetching FEX RootFS from $ROOTFS_URL"
|
||||||
|
curl -fsSL "$ROOTFS_URL" -o /tmp/fex-rootfs.sqsh
|
||||||
|
|
||||||
|
# Extracted instead of mounted: works in containers without FUSE/SYS_ADMIN
|
||||||
|
mkdir -p /opt/fex-emu-rootfs
|
||||||
|
unsquashfs -q -d /opt/fex-emu-rootfs/rootfs /tmp/fex-rootfs.sqsh
|
||||||
|
rm -f /tmp/fex-rootfs.sqsh
|
||||||
|
else
|
||||||
|
# Box64 fallback
|
||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y debian-keyring
|
DEBIAN_FRONTEND=noninteractive apt-get install -y debian-keyring
|
||||||
|
|
||||||
curl -L https://ryanfortner.github.io/box64-debs/box64.list -o /etc/apt/sources.list.d/box64.list
|
curl -L https://ryanfortner.github.io/box64-debs/box64.list -o /etc/apt/sources.list.d/box64.list
|
||||||
@@ -13,7 +51,7 @@ if [ "$TARGETARCH" = "arm64" ] ; then
|
|||||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||||
"$BOX64_PACKAGE" \
|
"$BOX64_PACKAGE" \
|
||||||
libjemalloc2
|
libjemalloc2
|
||||||
|
|
||||||
apt-get clean
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
apt-get clean
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
@@ -4,6 +4,8 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
# NetherNet: replace 192.168.1.10 with the IP address of the Docker host
|
# NetherNet: replace 192.168.1.10 with the IP address of the Docker host
|
||||||
|
# If this server is meant to be accessible over the internet, and has a dynamic you
|
||||||
|
# can use "<public_ip>" in place of an ip address to resolve your public ip on startup
|
||||||
SERVER_UDP_PORTS: "192.168.1.10:19140-19155:19140-19155"
|
SERVER_UDP_PORTS: "192.168.1.10:19140-19155:19140-19155"
|
||||||
ports:
|
ports:
|
||||||
# Note the newer NetherNet protocol uses different ports to RakNet
|
# Note the newer NetherNet protocol uses different ports to RakNet
|
||||||
|
|||||||
@@ -12,5 +12,12 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"packageRules": [
|
||||||
|
{
|
||||||
|
"matchManagers": ["custom.regex"],
|
||||||
|
"matchUpdateTypes": ["patch"],
|
||||||
|
"groupName": "Dockerfile patch updates"
|
||||||
|
}
|
||||||
|
],
|
||||||
"labels": ["dependencies"]
|
"labels": ["dependencies"]
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user