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

Supports property removal, starting with white-list #351

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
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
23 changes: 23 additions & 0 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
## Using development copy of mc-image-helper

In the cloned copy of [`mc-image-helper`](https://github.com/itzg/mc-image-helper), create an up-to-date snapshot build of the tgz distribution using:

```shell
./gradlew distTar
```

**NOTE** The distribution's version will be `0.0.0-<branch>-SNAPSHOT`

Assuming Java 18 or newer:

```shell
cd build/distributions
jwebserver -b 0.0.0.0 -p 8008
```

```shell
--build-arg MC_HELPER_VERSION=1.8.1-SNAPSHOT \
--build-arg MC_HELPER_BASE_URL=http://host.docker.internal:8008
```

Now the image can be built like normal, and it will install mc-image-helper from the locally built copy.
15 changes: 12 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
FROM debian
# using focal, rather than jammy to align with latest in
# https://github.com/itzg/docker-minecraft-server/blob/master/.github/workflows/build-multiarch.yml
ARG BASE_IMAGE=eclipse-temurin:17-jre-focal
FROM ${BASE_IMAGE}

# hook into docker BuildKit --platform support
# see https://docs.docker.com/engine/reference/builder/#automatic-platform-args-in-the-global-scope
Expand Down Expand Up @@ -38,12 +41,18 @@ RUN chmod +x /usr/local/bin/easy-add

RUN easy-add --var version=0.4.0 --var app=entrypoint-demoter --file {{.app}} --from https://github.com/itzg/{{.app}}/releases/download/v{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz

RUN easy-add --var version=0.1.1 --var app=set-property --file {{.app}} --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz

RUN easy-add --var version=1.6.2 --var app=restify --file {{.app}} --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz

RUN easy-add --var version=0.5.0 --var app=mc-monitor --file {{.app}} --from https://github.com/itzg/{{.app}}/releases/download/{{.version}}/{{.app}}_{{.version}}_linux_${TARGETARCH}.tar.gz

ARG MC_HELPER_VERSION=1.35.0
ARG MC_HELPER_BASE_URL=https://github.com/itzg/mc-image-helper/releases/download/${MC_HELPER_VERSION}
# used for cache busting local copy of mc-image-helper
ARG MC_HELPER_REV=1
RUN curl -fsSL ${MC_HELPER_BASE_URL}/mc-image-helper-${MC_HELPER_VERSION}.tgz \
| tar -C /usr/share -zxf - \
&& ln -s /usr/share/mc-image-helper-${MC_HELPER_VERSION}/bin/mc-image-helper /usr/bin

COPY *.sh /opt/

COPY property-definitions.json /etc/bds-property-definitions.json
Expand Down
3 changes: 2 additions & 1 deletion bedrock-entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function isTrue() {
function lookupVersion() {
platform=${1:?Missing required platform indicator}

# shellcheck disable=SC2034
for i in {1..3}; do
DOWNLOAD_URL=$(restify --user-agent=itzg/minecraft-bedrock-server --headers "accept-language:*" --attribute=data-platform="${platform}" "${downloadPage}" 2> restify.err | jq -r '.[0].href' || echo '')
if [[ ${DOWNLOAD_URL} ]]; then
Expand Down Expand Up @@ -183,7 +184,7 @@ if [[ -v ALLOW_LIST_USERS || -v WHITE_LIST_USERS ]]; then
export WHITE_LIST ALLOW_LIST
fi

set-property --file server.properties --bulk /etc/bds-property-definitions.json
mc-image-helper set-properties --definitions /etc/bds-property-definitions.json server.properties

export LD_LIBRARY_PATH=.

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions property-definitions.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@
"allowed": ["true","false"]
},
"white-list": {
"env": "WHITE_LIST",
"allowed": ["true","false"]
"remove": true
},
"allow-list": {
"env": "ALLOW_LIST",
Expand Down