mirror of
https://github.com/itzg/docker-minecraft-server.git
synced 2026-02-20 16:26:23 +00:00
Compare commits
60 Commits
1.13.0
...
2021.6.0-j
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6d3f194ce3 | ||
|
|
861aec6bd6 | ||
|
|
53f5fbb77f | ||
|
|
9299f00d20 | ||
|
|
e5e97a3560 | ||
|
|
32bc0382d6 | ||
|
|
fa53abdfb7 | ||
|
|
0cbfb81b4c | ||
|
|
d47c801b18 | ||
|
|
c056b9d2dd | ||
|
|
92a15ea85d | ||
|
|
6fe022ccc8 | ||
|
|
21c1620f0c | ||
|
|
b71eb666a7 | ||
|
|
e78e5af96d | ||
|
|
a2ab0d75ed | ||
|
|
0fb9700fc7 | ||
|
|
c48f6c31ce | ||
|
|
b2d23edf6d | ||
|
|
18925ef32c | ||
|
|
31f25cfd1b | ||
|
|
7d4e4c167e | ||
|
|
f06b990f8a | ||
|
|
eb12030975 | ||
|
|
e46af9d54c | ||
|
|
861faaa285 | ||
|
|
8312233a93 | ||
|
|
75844ae81a | ||
|
|
959bf73485 | ||
|
|
6bb2323c46 | ||
|
|
beeaf1a996 | ||
|
|
96aa1054dc | ||
|
|
e7937206af | ||
|
|
081b2c11e4 | ||
|
|
f342f4aa98 | ||
|
|
4e73e69342 | ||
|
|
c6ff80b71c | ||
|
|
37cad3f255 | ||
|
|
7814ca21b5 | ||
|
|
5700f36a6f | ||
|
|
b8806629ec | ||
|
|
4a7f838a0f | ||
|
|
34f800d815 | ||
|
|
2d07dee4df | ||
|
|
ffec50141a | ||
|
|
54027049d3 | ||
|
|
4c2829e3d2 | ||
|
|
69e308d420 | ||
|
|
ad46f10b55 | ||
|
|
cd0fdfc95b | ||
|
|
d95abfce82 | ||
|
|
942a125e04 | ||
|
|
a3677d5aa8 | ||
|
|
f927933c46 | ||
|
|
5ab83bcb21 | ||
|
|
fdf5fb46bc | ||
|
|
8c6ca5e999 | ||
|
|
bb2b9eeea9 | ||
|
|
d1cbce3f89 | ||
|
|
55b5f6821f |
82
.github/workflows/build-multiarch.yml
vendored
Normal file
82
.github/workflows/build-multiarch.yml
vendored
Normal file
@@ -0,0 +1,82 @@
|
|||||||
|
name: Build and publish multiarch
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- multiarch
|
||||||
|
- java8-multiarch
|
||||||
|
- multiarch-latest
|
||||||
|
- java15
|
||||||
|
- test/multiarch/*
|
||||||
|
tags:
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-multiarch"
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-multiarch-latest"
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-java15"
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
docker-buildx:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2.2.0
|
||||||
|
|
||||||
|
- name: Prepare
|
||||||
|
id: prep
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGE=itzg/minecraft-server
|
||||||
|
VERSION=edge
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/heads/}
|
||||||
|
if [[ $VERSION == master ]]; then
|
||||||
|
VERSION=latest
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
TAGS="${DOCKER_IMAGE}:${VERSION//\//-}"
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
echo ::set-output name=cache_from::${TAGS}
|
||||||
|
echo ::set-output name=version::${VERSION//\//-}
|
||||||
|
echo ::set-output name=cache_version::${VERSION//\//-}
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
|
||||||
|
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: docker/setup-qemu-action@v1
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
id: docker_build
|
||||||
|
uses: docker/build-push-action@v2
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
platforms: linux/amd64,linux/arm/v7,linux/arm64
|
||||||
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
|
# ensure latest base image is used
|
||||||
|
pull: true
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
|
||||||
|
org.opencontainers.image.source=https://github.com/itzg/docker-minecraft-server
|
||||||
|
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
|
||||||
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
80
.github/workflows/main.yml
vendored
80
.github/workflows/main.yml
vendored
@@ -4,24 +4,22 @@ on:
|
|||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
- master
|
||||||
|
- java8
|
||||||
- openj9
|
- openj9
|
||||||
- openj9-nightly
|
- openj9-11
|
||||||
- adopt11
|
- adopt11
|
||||||
- adopt13
|
- test/*
|
||||||
- adopt14
|
|
||||||
- adopt15
|
|
||||||
tags:
|
tags:
|
||||||
- "[0-9]+.[0-9]+.[0-9]+"
|
- "[0-9]+.[0-9]+.[0-9]+"
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-java8"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-openj9"
|
- "[0-9]+.[0-9]+.[0-9]+-openj9"
|
||||||
|
- "[0-9]+.[0-9]+.[0-9]+-openj9-11"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
|
- "[0-9]+.[0-9]+.[0-9]+-openj9-nightly"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
|
- "[0-9]+.[0-9]+.[0-9]+-adopt11"
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt13"
|
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt14"
|
|
||||||
- "[0-9]+.[0-9]+.[0-9]+-adopt15"
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
@@ -32,20 +30,68 @@ jobs:
|
|||||||
build:
|
build:
|
||||||
needs:
|
needs:
|
||||||
- test
|
- test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Build and push Docker images
|
- name: Prepare
|
||||||
uses: docker/build-push-action@v1.1.0
|
id: prep
|
||||||
|
run: |
|
||||||
|
DOCKER_IMAGE=itzg/minecraft-server
|
||||||
|
VERSION=edge
|
||||||
|
if [[ $GITHUB_REF == refs/tags/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/tags/}
|
||||||
|
fi
|
||||||
|
if [[ $GITHUB_REF == refs/heads/* ]]; then
|
||||||
|
VERSION=${GITHUB_REF#refs/heads/}
|
||||||
|
if [[ $VERSION == master ]]; then
|
||||||
|
VERSION=latest
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
TAGS="${DOCKER_IMAGE}:${VERSION//\//-}"
|
||||||
|
echo ::set-output name=tags::${TAGS}
|
||||||
|
echo ::set-output name=cache_from::${TAGS}
|
||||||
|
echo ::set-output name=version::${VERSION//\//-}
|
||||||
|
echo ::set-output name=cache_version::${VERSION//\//-}
|
||||||
|
|
||||||
|
- name: Setup Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v1
|
||||||
|
|
||||||
|
- name: Cache Docker layers
|
||||||
|
uses: actions/cache@v2
|
||||||
|
with:
|
||||||
|
path: /tmp/.buildx-cache
|
||||||
|
key: ${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-${{ github.sha }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-buildx-${{ steps.prep.outputs.cache_version }}-
|
||||||
|
${{ runner.os }}-buildx-
|
||||||
|
|
||||||
|
- name: Login to DockerHub
|
||||||
|
uses: docker/login-action@v1
|
||||||
with:
|
with:
|
||||||
repository: itzg/minecraft-server
|
|
||||||
username: ${{ secrets.DOCKER_USER }}
|
username: ${{ secrets.DOCKER_USER }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
tag_with_ref: true
|
|
||||||
tag_with_sha: false
|
- name: Build and push
|
||||||
cache_froms: itzg/minecraft-server:latest
|
id: docker_build
|
||||||
add_git_labels: true
|
uses: docker/build-push-action@v2
|
||||||
labels: org.opencontainers.image.url=https://github.com/itzg/docker-minecraft-server,org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
|
with:
|
||||||
|
context: .
|
||||||
|
file: ./Dockerfile
|
||||||
|
# ensure latest base image is used
|
||||||
|
pull: true
|
||||||
|
# publish
|
||||||
push: true
|
push: true
|
||||||
|
# tags determined by prep step
|
||||||
|
tags: ${{ steps.prep.outputs.tags }}
|
||||||
|
cache-from: type=local,src=/tmp/.buildx-cache
|
||||||
|
cache-to: type=local,dest=/tmp/.buildx-cache
|
||||||
|
labels: |
|
||||||
|
org.opencontainers.image.documentation=https://github.com/itzg/docker-minecraft-server
|
||||||
|
org.opencontainers.image.version=${{ steps.prep.outputs.version }}
|
||||||
|
org.opencontainers.image.source=https://github.com/itzg/docker-minecraft-server
|
||||||
|
org.opencontainers.image.revision=${{ github.sha }}
|
||||||
|
|
||||||
|
- name: Image digest
|
||||||
|
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||||
|
|||||||
@@ -71,9 +71,9 @@ WORKDIR /data
|
|||||||
|
|
||||||
ENV UID=1000 GID=1000 \
|
ENV UID=1000 GID=1000 \
|
||||||
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
|
||||||
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= FABRICVERSION=LATEST LEVEL=world \
|
TYPE=VANILLA VERSION=LATEST \
|
||||||
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
|
||||||
LEVEL_TYPE=DEFAULT SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
SERVER_PORT=25565 ONLINE_MODE=TRUE SERVER_NAME="Dedicated Server" \
|
||||||
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
ENABLE_AUTOPAUSE=false AUTOPAUSE_TIMEOUT_EST=3600 AUTOPAUSE_TIMEOUT_KN=120 AUTOPAUSE_TIMEOUT_INIT=600 \
|
||||||
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
AUTOPAUSE_PERIOD=10 AUTOPAUSE_KNOCK_INTERFACE=eth0
|
||||||
|
|
||||||
|
|||||||
148
README.md
148
README.md
@@ -116,8 +116,24 @@ to map a directory on your host machine to the container's `/data` directory, su
|
|||||||
|
|
||||||
docker run -d -v /path/on/host:/data ...
|
docker run -d -v /path/on/host:/data ...
|
||||||
|
|
||||||
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host`
|
When attached in this way you can stop the server, edit the configuration under your attached `/path/on/host` and start the server again with `docker start CONTAINER_ID` to pick up the new configuration.
|
||||||
and start the server again with `docker start CONTAINERID` to pick up the new configuration.
|
|
||||||
|
As example, using Docker compose, create the following `docker-compose.yml` in its own directory and the container will automatically create/attach the relative directory `data` to the container:
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
ports:
|
||||||
|
- 25565:25565
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
volumes:
|
||||||
|
# attach the relative directory 'data' to the container's /data path
|
||||||
|
- ./data:/data
|
||||||
|
```
|
||||||
|
|
||||||
## Versions
|
## Versions
|
||||||
|
|
||||||
@@ -144,23 +160,31 @@ the server jar remain in the `/data` directory. It is safe to remove those._
|
|||||||
|
|
||||||
To use a different version of Java, please use a docker tag to run your Minecraft server.
|
To use a different version of Java, please use a docker tag to run your Minecraft server.
|
||||||
|
|
||||||
| Tag name | Description | Linux |
|
| Tag name | Java version | Linux | JVM Type | Architecture |
|
||||||
| -------------- | ------------------------------------------- | ------------ |
|
| -------------- | -------------|--------|----------|-------------------|
|
||||||
| latest | **Default**. Uses Java version 8 | Alpine Linux |
|
| latest | 11 | Alpine | Hotspot | amd64 |
|
||||||
| adopt15 | Uses Java version 15 from AdoptOpenJDK | Alpine Linux |
|
| java8 | 8 | Alpine | Hotspot | amd64 |
|
||||||
| adopt14 | Uses Java version 14 from AdoptOpenJDK | Alpine Linux |
|
| java8-multiarch | 8 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||||
| adopt13 | Uses Java version 13 from AdoptOpenJDK | Alpine Linux |
|
| java15 | 15 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||||
| adopt11 | Uses Java version 11 from AdoptOpenJDK | Alpine Linux |
|
| adopt11 | 11 | Alpine | Hotspot | amd64 |
|
||||||
| openj9 | Uses Eclipse OpenJ9 JVM | Alpine Linux |
|
| openj9 | 8 | Alpine | OpenJ9 | amd64 |
|
||||||
| openj9-nightly | Uses Eclipse OpenJ9 JVM testing builds | Alpine Linux |
|
| openj9-11 | 11 | Alpine | OpenJ9 | amd64 |
|
||||||
| multiarch | Uses Java version 8 latest update | Debian Linux |
|
| multiarch | 11 | Debian | Hotspot | amd64,arm64,armv7 |
|
||||||
| multiarch-latest | Uses Java version 15 latest update | Debian Linux |
|
| multiarch-latest | 15+ | Debian | Hotspot | amd64,arm64,armv7 |
|
||||||
|
|
||||||
For example, to use a Java version 13:
|
For example, to use Java version 15 on any supported architecture:
|
||||||
|
|
||||||
docker run --name mc itzg/minecraft-server:adopt13
|
docker run --name mc itzg/minecraft-server:java15
|
||||||
|
|
||||||
Keep in mind that some versions of Minecraft server can't work on the newest versions of Java. Also, FORGE doesn't support openj9 JVM implementation.
|
> Keep in mind that some versions of Minecraft server can't work on the newest versions of Java. Also, FORGE doesn't support openj9 JVM implementation.
|
||||||
|
|
||||||
|
### Deprecated Image Tags
|
||||||
|
|
||||||
|
The following image tags have been deprecated and are no longer receiving updates:
|
||||||
|
- adopt13
|
||||||
|
- adopt14
|
||||||
|
- adopt15
|
||||||
|
- openj9-nightly
|
||||||
|
|
||||||
## Healthcheck
|
## Healthcheck
|
||||||
|
|
||||||
@@ -237,12 +261,13 @@ If you're looking for a simple way to deploy this to the Amazon Web Services Clo
|
|||||||
|
|
||||||
## Running a Forge Server
|
## Running a Forge Server
|
||||||
|
|
||||||
Enable Forge server mode by adding a `-e TYPE=FORGE` to your command-line.
|
Enable [Forge server](http://www.minecraftforge.net/wiki/) mode by adding a `-e TYPE=FORGE` to your command-line.
|
||||||
By default the container will run the `RECOMMENDED` version of [Forge server](http://www.minecraftforge.net/wiki/)
|
|
||||||
but you can also choose to run a specific version with `-e FORGEVERSION=10.13.4.1448`.
|
The overall version is specified by `VERSION`, [as described in the section above](#versions) and will run the recommended Forge version by default. You can also choose to run a specific Forge version with `FORGEVERSION`, such as `-e FORGEVERSION=14.23.5.2854`.
|
||||||
|
|
||||||
$ docker run -d -v /path/on/host:/data \
|
$ docker run -d -v /path/on/host:/data \
|
||||||
-e TYPE=FORGE -e FORGEVERSION=10.13.4.1448 \
|
-e TYPE=FORGE \
|
||||||
|
-e VERSION=1.12.2 -e FORGEVERSION=14.23.5.2854 \
|
||||||
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
-p 25565:25565 -e EULA=TRUE --name mc itzg/minecraft-server
|
||||||
|
|
||||||
To use a pre-downloaded Forge installer, place it in the attached `/data` directory and
|
To use a pre-downloaded Forge installer, place it in the attached `/data` directory and
|
||||||
@@ -462,6 +487,30 @@ A [Tuinity](https://github.com/Spottedleaf/Tuinity) server, which is a fork of P
|
|||||||
|
|
||||||
> **NOTE** only `VERSION=LATEST` is supported
|
> **NOTE** only `VERSION=LATEST` is supported
|
||||||
|
|
||||||
|
## Running a Purpur server
|
||||||
|
|
||||||
|
A [Purpur](https://purpur.pl3x.net/) server, which is "a fork of Paper and Tuinity with the goal of providing new and interesting configuration options".
|
||||||
|
|
||||||
|
-e TYPE=PURPUR
|
||||||
|
|
||||||
|
> NOTE: the `VERSION` variable is used to lookup a build of Purpur to download
|
||||||
|
|
||||||
|
Extra variables:
|
||||||
|
- `PURPUR_BUILD=LATEST` : set a specific Purpur build to use
|
||||||
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
|
|
||||||
|
## Running a Yatopia server
|
||||||
|
|
||||||
|
A [Yatopia](https://github.com/YatopiaMC/Yatopia) server, which is a "blazing fast Tuinity fork with best in class performance".
|
||||||
|
|
||||||
|
-e TYPE=YATOPIA
|
||||||
|
|
||||||
|
> NOTE: the `VERSION` variable is used to locate the Yatopia version to download
|
||||||
|
|
||||||
|
Extra variables:
|
||||||
|
- `RELEASE=stable` : set to `stable` or `latest`
|
||||||
|
- `FORCE_REDOWNLOAD=false` : set to true to force the located server jar to be re-downloaded
|
||||||
|
|
||||||
## Running a Magma server
|
## Running a Magma server
|
||||||
|
|
||||||
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
A [Magma](https://magmafoundation.org/) server, which is a combination of Forge and PaperMC, can be used with
|
||||||
@@ -479,6 +528,9 @@ A [Mohist](https://github.com/Mohist-Community/Mohist) server can be used with
|
|||||||
|
|
||||||
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
|
> **NOTE** there are limited base versions supported, so you will also need to set `VERSION`, such as "1.12.2"
|
||||||
|
|
||||||
|
By default the latest build will be used; however, a specific build number can be selected by setting `MOHIST_BUILD`, such as
|
||||||
|
|
||||||
|
-e VERSION=1.16.5 -e MOHIST_BUILD=374
|
||||||
|
|
||||||
## Running a Catserver type server
|
## Running a Catserver type server
|
||||||
|
|
||||||
@@ -490,7 +542,7 @@ A [Catserver](http://catserver.moe/) type server can be used with
|
|||||||
|
|
||||||
## Running a server with a Feed the Beast modpack
|
## Running a server with a Feed the Beast modpack
|
||||||
|
|
||||||
> **NOTE** requires `itzg/minecraft-server:multiarch` image
|
> **NOTE** requires one of the Debian based images listed in [the Java versions section](#running-minecraft-server-on-different-java-version).
|
||||||
|
|
||||||
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
|
[Feed the Beast application](https://www.feed-the-beast.com/) modpacks are supported by using `-e TYPE=FTBA` (**note** the "A" at the end of the type). This server type will automatically take care of downloading and installing the modpack and appropriate version of Forge, so the `VERSION` does not need to be specified.
|
||||||
|
|
||||||
@@ -680,16 +732,14 @@ every time you want to create new Minecraft server, you can now use
|
|||||||
|
|
||||||
```
|
```
|
||||||
minecraft-server:
|
minecraft-server:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
|
||||||
ports:
|
ports:
|
||||||
- "25565:25565"
|
- "25565:25565"
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
EULA: "TRUE"
|
EULA: "TRUE"
|
||||||
|
|
||||||
image: itzg/minecraft-server
|
|
||||||
|
|
||||||
container_name: mc
|
|
||||||
|
|
||||||
tty: true
|
tty: true
|
||||||
stdin_open: true
|
stdin_open: true
|
||||||
restart: always
|
restart: always
|
||||||
@@ -751,12 +801,18 @@ To whitelist players for your Minecraft server, pass the Minecraft usernames sep
|
|||||||
|
|
||||||
If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.
|
If the `WHITELIST` environment variable is not used, any user can join your Minecraft server if it's publicly accessible.
|
||||||
|
|
||||||
|
> NOTE: When `WHITELIST` is used the server property `white-list` will automatically get set to `true`.
|
||||||
|
|
||||||
|
> By default, the players in `WHITELIST` are **added** to the final `whitelist.json` file by the Minecraft server. If you set `OVERRIDE_WHITELIST` to "true" then the `whitelist.json` file will be recreated on each server startup.
|
||||||
|
|
||||||
### Op/Administrator Players
|
### Op/Administrator Players
|
||||||
|
|
||||||
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
|
To add more "op" (aka adminstrator) users to your Minecraft server, pass the Minecraft usernames separated by commas via the `OPS` environment variable, such as
|
||||||
|
|
||||||
docker run -d -e OPS=user1,user2 ...
|
docker run -d -e OPS=user1,user2 ...
|
||||||
|
|
||||||
|
> By default, the players in `OPS` are **added** to the final `ops.json` file by the Minecraft server. If you set `OVERRIDE_OPS` to "true" then the `ops.json` file will be recreated on each server startup.
|
||||||
|
|
||||||
### Server icon
|
### Server icon
|
||||||
|
|
||||||
A server icon can be configured using the `ICON` variable. The image will be automatically
|
A server icon can be configured using the `ICON` variable. The image will be automatically
|
||||||
@@ -764,6 +820,10 @@ downloaded, scaled, and converted from any other image format:
|
|||||||
|
|
||||||
docker run -d -e ICON=http://..../some/image.png ...
|
docker run -d -e ICON=http://..../some/image.png ...
|
||||||
|
|
||||||
|
The server icon which has been set doesn't get overridden by default. It can be changed and overridden by setting `OVERRIDE_ICON` to `TRUE`.
|
||||||
|
|
||||||
|
docker run -d -e ICON=http://..../some/other/image.png -e OVERRIDE_ICON=TRUE...
|
||||||
|
|
||||||
### Rcon
|
### Rcon
|
||||||
|
|
||||||
To use rcon use the `ENABLE_RCON` and `RCON_PASSORD` variables.
|
To use rcon use the `ENABLE_RCON` and `RCON_PASSORD` variables.
|
||||||
@@ -887,7 +947,11 @@ It determines the server-side viewing distance.
|
|||||||
|
|
||||||
If you want to create the Minecraft level with a specific seed, use `SEED`, such as
|
If you want to create the Minecraft level with a specific seed, use `SEED`, such as
|
||||||
|
|
||||||
docker run -d -e SEED=1785852800490497919 ...
|
-e SEED=1785852800490497919
|
||||||
|
|
||||||
|
If using a negative value for the seed, make sure to quote the value such as:
|
||||||
|
|
||||||
|
-e SEED="-1785852800490497919"
|
||||||
|
|
||||||
### Game Mode
|
### Game Mode
|
||||||
|
|
||||||
@@ -909,16 +973,13 @@ For example:
|
|||||||
|
|
||||||
The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as
|
The message of the day, shown below each server entry in the UI, can be changed with the `MOTD` environment variable, such as
|
||||||
|
|
||||||
docker run -d -e 'MOTD=My Server' ...
|
-e MOTD="My Server"
|
||||||
|
|
||||||
If you leave it off, a default is computed from the server type and version, such as
|
If you leave it off, a default is computed from the server type and version, such as
|
||||||
|
|
||||||
A Paper Minecraft Server powered by Docker
|
A Paper Minecraft Server powered by Docker
|
||||||
|
|
||||||
when `TYPE` is `PAPER`. That way you can easily differentiate between several servers you may have started.
|
That way you can easily differentiate between several servers you may have started.
|
||||||
|
|
||||||
_The example shows how to specify a server message of the day that contains spaces by putting quotes
|
|
||||||
around the whole thing._
|
|
||||||
|
|
||||||
### PVP Mode
|
### PVP Mode
|
||||||
|
|
||||||
@@ -930,7 +991,7 @@ environment variable set to `false`, such as
|
|||||||
### Level Type and Generator Settings
|
### Level Type and Generator Settings
|
||||||
|
|
||||||
By default, a standard world is generated with hills, valleys, water, etc. A different level type can
|
By default, a standard world is generated with hills, valleys, water, etc. A different level type can
|
||||||
be configured by setting `LEVEL_TYPE` to an expected type, such as
|
be configured by setting `LEVEL_TYPE` to an expected type, for example
|
||||||
|
|
||||||
- DEFAULT
|
- DEFAULT
|
||||||
- FLAT
|
- FLAT
|
||||||
@@ -938,6 +999,8 @@ be configured by setting `LEVEL_TYPE` to an expected type, such as
|
|||||||
- AMPLIFIED
|
- AMPLIFIED
|
||||||
- CUSTOMIZED
|
- CUSTOMIZED
|
||||||
- BUFFET
|
- BUFFET
|
||||||
|
- BIOMESOP (Biomes O' Plenty for 1.12 and older)
|
||||||
|
- BIOMESOPLENTY (Biomes O' Plenty for 1.15 and above)
|
||||||
|
|
||||||
Descriptions are available at the [gamepedia](http://minecraft.gamepedia.com/Server.properties).
|
Descriptions are available at the [gamepedia](http://minecraft.gamepedia.com/Server.properties).
|
||||||
|
|
||||||
@@ -1068,19 +1131,18 @@ is passed to `docker run`.
|
|||||||
|
|
||||||
### Memory Limit
|
### Memory Limit
|
||||||
|
|
||||||
By default, the image declares a Java initial and maximum memory limit of 1 GB. There are several
|
By default, the image declares an initial and maximum Java memory-heap limit of 1 GB. There are several ways to adjust the memory settings:
|
||||||
ways to adjust the memory settings:
|
|
||||||
|
|
||||||
- `MEMORY`, "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`)
|
- `MEMORY`: "1G" by default, can be used to adjust both initial (`Xms`) and max (`Xmx`) memory heap settings of the JVM
|
||||||
memory settings of the JVM
|
- `INIT_MEMORY`: independently sets the initial heap size
|
||||||
- `INIT_MEMORY`, independently sets the initial heap size
|
- `MAX_MEMORY`: independently sets the max heap size
|
||||||
- `MAX_MEMORY`, independently sets the max heap size
|
|
||||||
|
|
||||||
The values of all three are passed directly to the JVM and support format/units as
|
The values of all three are passed directly to the JVM and support format/units as `<size>[g|G|m|M|k|K]`. For example:
|
||||||
`<size>[g|G|m|M|k|K]`. For example:
|
|
||||||
|
|
||||||
-e MEMORY=2G
|
-e MEMORY=2G
|
||||||
|
|
||||||
|
> NOTE: the settings above only set the Java **heap** limits. Memory resource requests and limits on the overall container should also account for non-heap memory usage. An extra 25% is [a general best practice](https://dzone.com/articles/best-practices-java-memory-arguments-for-container).
|
||||||
|
|
||||||
### JVM Options
|
### JVM Options
|
||||||
|
|
||||||
General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS`
|
General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS`
|
||||||
@@ -1092,9 +1154,11 @@ For some cases, if e.g. after removing mods, it could be necessary to startup mi
|
|||||||
|
|
||||||
### Enable Remote JMX for Profiling
|
### Enable Remote JMX for Profiling
|
||||||
|
|
||||||
To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable `ENABLE_JMX=true` and add a port forwarding of TCP port 7091, such as:
|
To enable remote JMX, such as for profiling with VisualVM or JMC, add the environment variable `ENABLE_JMX=true`, set `JMX_HOST` to the IP/host running the Docker container, and add a port forwarding of TCP port 7091, such as:
|
||||||
|
|
||||||
-e ENABLE_JMX=true -p 7091:7091
|
```
|
||||||
|
-e ENABLE_JMX=true -e JMX_HOST=$HOSTNAME -p 7091:7091
|
||||||
|
```
|
||||||
|
|
||||||
### Enable Aikar's Flags
|
### Enable Aikar's Flags
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#set -x
|
#set -x
|
||||||
# Use this variable to indicate a list of branches that docker hub is watching
|
# Use this variable to indicate a list of branches that docker hub is watching
|
||||||
branches_list=('openj9' 'openj9-nightly' 'adopt11' 'adopt13' 'adopt14' 'adopt15' 'multiarch' 'multiarch-latest')
|
branches_list=('java8' 'java8-multiarch' 'openj9' 'openj9-11' 'adopt11' 'java15' 'multiarch' 'multiarch-latest')
|
||||||
|
|
||||||
function TrapExit {
|
function TrapExit {
|
||||||
echo "Checking out back in master"
|
echo "Checking out back in master"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ version: '3.2'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
image: itzg/minecraft-server
|
image: itzg/minecraft-server:java8
|
||||||
volumes:
|
volumes:
|
||||||
- ./modpacks:/modpacks:ro
|
- ./modpacks:/modpacks:ro
|
||||||
environment:
|
environment:
|
||||||
|
|||||||
@@ -1,20 +0,0 @@
|
|||||||
version: "3.7"
|
|
||||||
|
|
||||||
services:
|
|
||||||
mc:
|
|
||||||
image: itzg/minecraft-server
|
|
||||||
ports:
|
|
||||||
- 25565:25565
|
|
||||||
volumes:
|
|
||||||
# Attach .../Curse/Minecraft/Instances for use at /instances
|
|
||||||
- ./Instances:/instances:ro
|
|
||||||
# Attach /data as usual
|
|
||||||
- ./ServerData:/data
|
|
||||||
environment:
|
|
||||||
EULA: "TRUE"
|
|
||||||
# Modpacks generally need more memory, so let's give at 2 GB
|
|
||||||
MEMORY: 2G
|
|
||||||
# Use new CURSE_INSTANCE type
|
|
||||||
TYPE: CURSE_INSTANCE
|
|
||||||
# Reference directory of or full path to minecraftinstance.json
|
|
||||||
CURSE_INSTANCE_JSON: /instances/FTB Presents SkyFactory 3
|
|
||||||
@@ -2,7 +2,7 @@ version: "3.7"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
image: itzg/minecraft-server
|
image: itzg/minecraft-server:java8
|
||||||
ports:
|
ports:
|
||||||
# expose the Minecraft server port outside of container
|
# expose the Minecraft server port outside of container
|
||||||
- 25565:25565
|
- 25565:25565
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ version: "3.7"
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
mc:
|
mc:
|
||||||
# FTBA support is only available in multiarch image tag
|
# FTBA support is only available in non-Alpine images
|
||||||
image: itzg/minecraft-server:multiarch
|
image: itzg/minecraft-server:java8-multiarch
|
||||||
ports:
|
ports:
|
||||||
# expose the Minecraft server port outside of container
|
# expose the Minecraft server port outside of container
|
||||||
- 25565:25565
|
- 25565:25565
|
||||||
|
|||||||
12
examples/docker-compose-simple.yml
Normal file
12
examples/docker-compose-simple.yml
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
version: "3"
|
||||||
|
|
||||||
|
services:
|
||||||
|
mc:
|
||||||
|
image: itzg/minecraft-server
|
||||||
|
ports:
|
||||||
|
- 25565:25565
|
||||||
|
environment:
|
||||||
|
EULA: "TRUE"
|
||||||
|
volumes:
|
||||||
|
# attach the relative directory 'data' to the container's /data path
|
||||||
|
./data:/data
|
||||||
@@ -5,7 +5,7 @@ version: '3'
|
|||||||
|
|
||||||
services:
|
services:
|
||||||
minecraft:
|
minecraft:
|
||||||
image: itzg/minecraft-server
|
image: itzg/minecraft-server:java8
|
||||||
ports:
|
ports:
|
||||||
- "25565:25565"
|
- "25565:25565"
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
@@ -1,7 +1,13 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${EULA:=}
|
||||||
|
: ${PROXY:=}
|
||||||
|
: ${RCON_PASSWORD_FILE:=}
|
||||||
|
|
||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
#umask 002
|
#umask 002
|
||||||
@@ -55,7 +61,6 @@ if [[ $RCON_PASSWORD_FILE ]]; then
|
|||||||
log ""
|
log ""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SERVER_PROPERTIES=/data/server.properties
|
|
||||||
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
export VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json
|
||||||
|
|
||||||
case "X$VERSION" in
|
case "X$VERSION" in
|
||||||
@@ -134,11 +139,19 @@ case "${TYPE^^}" in
|
|||||||
exec ${SCRIPTS:-/}start-deployCatserver "$@"
|
exec ${SCRIPTS:-/}start-deployCatserver "$@"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
PURPUR)
|
||||||
|
exec ${SCRIPTS:-/}start-deployPurpur "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
|
YATOPIA)
|
||||||
|
exec ${SCRIPTS:-/}start-deployYatopia "$@"
|
||||||
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
log "Invalid type: '$TYPE'"
|
log "Invalid type: '$TYPE'"
|
||||||
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
log "Must be: VANILLA, FORGE, BUKKIT, SPIGOT, PAPER, FTBA (multiarch-only),"
|
||||||
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA,"
|
log " CURSE_INSTANCE, CURSEFORGE, SPONGEVANILLA, TUINITY, PURPUR"
|
||||||
log " CUSTOM, MAGMA, MOHIST, CATSERVER"
|
log " CUSTOM, MAGMA, MOHIST, CATSERVER, YATOPIA"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=FORGE
|
export TYPE=FORGE
|
||||||
|
: ${FORGEVERSION:=RECOMMENDED}
|
||||||
|
|
||||||
if [[ -z $FORGE_INSTALLER && -z $FORGE_INSTALLER_URL ]]; then
|
if [[ -z $FORGE_INSTALLER && -z $FORGE_INSTALLER_URL ]]; then
|
||||||
norm=$VANILLA_VERSION
|
norm=$VANILLA_VERSION
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ set -e
|
|||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
requireVar VANILLA_VERSION
|
requireVar VANILLA_VERSION
|
||||||
|
: ${MOHIST_BUILD:=lastSuccessfulBuild}
|
||||||
|
|
||||||
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
|
mohistJobs=https://ci.codemc.io/job/Mohist-Community/job/
|
||||||
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
|
mohistJob=${mohistJobs}Mohist-${VANILLA_VERSION}/
|
||||||
@@ -17,12 +18,12 @@ if ! curl -X HEAD -o /dev/null -fsSL "${mohistJob}"; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
latestBuildRelPath=$(
|
buildRelPath=$(
|
||||||
curl -fsSL "${mohistJob}lastSuccessfulBuild/api/json" |
|
curl -fsSL "${mohistJob}${MOHIST_BUILD}/api/json" |
|
||||||
jq -r '.artifacts[0].relativePath'
|
jq -r '.artifacts[0].relativePath'
|
||||||
)
|
)
|
||||||
|
|
||||||
baseName=$(basename "${latestBuildRelPath}")
|
baseName=$(basename "${buildRelPath}")
|
||||||
if [[ ${baseName} != *-server.jar* ]]; then
|
if [[ ${baseName} != *-server.jar* ]]; then
|
||||||
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
|
log "ERROR: mohist build for ${VANILLA_VERSION} is not a valid server jar, found ${baseName}"
|
||||||
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
|
log " check https://ci.codemc.io/job/Mohist-Community/ for available versions"
|
||||||
@@ -34,7 +35,7 @@ export SERVER="/data/${baseName}"
|
|||||||
|
|
||||||
if [ ! -f ${SERVER} ]; then
|
if [ ! -f ${SERVER} ]; then
|
||||||
log "Downloading ${baseName}"
|
log "Downloading ${baseName}"
|
||||||
curl -o "${SERVER}" -fsSL "${mohistJob}lastSuccessfulBuild/artifact/${latestBuildRelPath}"
|
curl -o "${SERVER}" -fsSL "${mohistJob}${MOHIST_BUILD}/artifact/${buildRelPath}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|||||||
@@ -17,8 +17,8 @@ if [[ $PAPER_DOWNLOAD_URL ]]; then
|
|||||||
else
|
else
|
||||||
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
# PaperMC API v2 docs : https://papermc.io/api/docs/swagger-ui/index.html?configUrl=/api/openapi/swagger-config
|
||||||
|
|
||||||
build=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
build=${PAPERBUILD:=$(curl -fsSL "https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}" -H "accept: application/json" \
|
||||||
| jq '.builds[-1]')
|
| jq '.builds[-1]')}
|
||||||
case $? in
|
case $? in
|
||||||
0)
|
0)
|
||||||
;;
|
;;
|
||||||
@@ -28,7 +28,7 @@ else
|
|||||||
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
|
VANILLA_VERSION=$(echo "$versions" | jq -r '.versions[-1]')
|
||||||
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
log "WARN: using ${VANILLA_VERSION} since that's the latest provided by PaperMC"
|
||||||
# re-execute the current script with the newly computed version
|
# re-execute the current script with the newly computed version
|
||||||
exec $0 "$@"
|
exec "$0" "$@"
|
||||||
fi
|
fi
|
||||||
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
|
log "ERROR: ${VANILLA_VERSION} is not published by PaperMC"
|
||||||
log " Set VERSION to one of the following: "
|
log " Set VERSION to one of the following: "
|
||||||
@@ -56,6 +56,11 @@ else
|
|||||||
zarg=(-z "$SERVER")
|
zarg=(-z "$SERVER")
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
log "Removing old PaperMC versions ..."
|
||||||
|
for f in paper-*.jar; do
|
||||||
|
[[ $f != $SERVER ]] && rm $f
|
||||||
|
done
|
||||||
|
|
||||||
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
log "Downloading PaperMC $VANILLA_VERSION (build $build) ..."
|
||||||
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
curl -fsSL -o "$SERVER" "${zarg[@]}" \
|
||||||
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
"https://papermc.io/api/v2/projects/paper/versions/${VANILLA_VERSION}/builds/${build}/downloads/${SERVER}" \
|
||||||
@@ -71,4 +76,4 @@ export TYPE=SPIGOT
|
|||||||
export SKIP_LOG4J_CONFIG=true
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
exec ${SCRIPTS:-/}start-finalSetupWorld "$@"
|
||||||
|
|||||||
38
start-deployPurpur
Executable file
38
start-deployPurpur
Executable file
@@ -0,0 +1,38 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
: ${VANILLA_VERSION:?}
|
||||||
|
: ${PURPUR_BUILD:=LATEST}
|
||||||
|
: ${FORCE_REDOWNLOAD:=false}
|
||||||
|
|
||||||
|
if [[ ${PURPUR_BUILD} == LATEST ]]; then
|
||||||
|
PURPUR_BUILD=$(curl -fsSL "https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}" |
|
||||||
|
jq -r '.builds.latest' || echo "")
|
||||||
|
if [[ -z ${PURPUR_BUILD} ]]; then
|
||||||
|
log "ERROR: Failed to locate a Purpur build for ${VANILLA_VERSION}."
|
||||||
|
log " Please check if a download is available at https://purpur.pl3x.net/downloads/"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SERVER="purpur-${VANILLA_VERSION}-${PURPUR_BUILD}.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
||||||
|
downloadUrl="https://purpur.pl3x.net/api/v1/purpur/${VANILLA_VERSION}/${PURPUR_BUILD}/download"
|
||||||
|
log "Downloading Purpur from $downloadUrl ..."
|
||||||
|
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
||||||
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Normalize on Spigot for later operations
|
||||||
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
@@ -3,6 +3,8 @@
|
|||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
export TYPE=spongevanilla
|
export TYPE=spongevanilla
|
||||||
|
: ${SPONGEBRANCH:=STABLE}
|
||||||
|
: ${SPONGEVERSION:=}
|
||||||
|
|
||||||
# Parse branch
|
# Parse branch
|
||||||
log "Choosing branch for Sponge"
|
log "Choosing branch for Sponge"
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ if [ ! -f "$SERVER" ] || [ -n "$FORCE_REDOWNLOAD" ]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Normalize on Spigot for operations below
|
# Normalize on Spigot for later operations
|
||||||
export TYPE=SPIGOT
|
export TYPE=SPIGOT
|
||||||
|
|
||||||
# Continue to Final Setup
|
# Continue to Final Setup
|
||||||
|
|||||||
30
start-deployYatopia
Normal file
30
start-deployYatopia
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
isDebugging && set -x
|
||||||
|
|
||||||
|
: ${VANILLA_VERSION:?}
|
||||||
|
: ${RELEASE:=stable}
|
||||||
|
: ${FORCE_REDOWNLOAD:=false}
|
||||||
|
|
||||||
|
requireEnum RELEASE stable latest
|
||||||
|
|
||||||
|
export SERVER="yatopia-${RELEASE}-${VANILLA_VERSION}.jar"
|
||||||
|
|
||||||
|
if [ ! -f "$SERVER" ] || isTrue "$FORCE_REDOWNLOAD"; then
|
||||||
|
downloadUrl="https://api.yatopiamc.org/v2/${RELEASE}Build/download?branch=ver/${VANILLA_VERSION}"
|
||||||
|
log "Downloading Yatopia from $downloadUrl ..."
|
||||||
|
if ! curl -fsSL -o "$SERVER" "$downloadUrl"; then
|
||||||
|
log "ERROR: failed to download from $downloadUrl (status=$?)"
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Normalize on Spigot for later operations
|
||||||
|
export TYPE=SPIGOT
|
||||||
|
export SKIP_LOG4J_CONFIG=true
|
||||||
|
|
||||||
|
# Continue to Final Setup
|
||||||
|
exec ${SCRIPTS:-/}start-finalSetupWorld $@
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
: ${ENV_VARIABLE_PREFIX:=CFG_}
|
: ${ENV_VARIABLE_PREFIX:=CFG_}
|
||||||
|
|
||||||
if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
||||||
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX..."
|
log "Replacing env variables in configs that match the prefix $ENV_VARIABLE_PREFIX ..."
|
||||||
|
|
||||||
# File excludes
|
# File excludes
|
||||||
fileExcludes=
|
fileExcludes=
|
||||||
@@ -22,28 +22,30 @@ if isTrue "${REPLACE_ENV_VARIABLES}"; then
|
|||||||
isDebugging && echo "Using find file exclusions: $fileExcludes"
|
isDebugging && echo "Using find file exclusions: $fileExcludes"
|
||||||
isDebugging && echo "Using find directory exclusions: $dirExcludes"
|
isDebugging && echo "Using find directory exclusions: $dirExcludes"
|
||||||
|
|
||||||
while IFS='=' read -r name value ; do
|
for name in $(compgen -v $ENV_VARIABLE_PREFIX); do
|
||||||
# check if name of env variable matches the prefix
|
# check if name of env variable matches the prefix
|
||||||
# sanity check environment variables to avoid code injections
|
# sanity check environment variables to avoid code injections
|
||||||
if [[ "$name" = $ENV_VARIABLE_PREFIX* ]] \
|
# Read content from file environment
|
||||||
&& [[ $value =~ ^[0-9a-zA-Z_:/=?.+\-]*$ ]] \
|
if [[ $name = *"_FILE" ]]; then
|
||||||
&& [[ $name =~ ^[0-9a-zA-Z_\-]*$ ]]; then
|
value=$(<${!name})
|
||||||
# Read content from file environment
|
name="${name%_FILE}"
|
||||||
if [[ $name = *"_FILE" ]] && [[ -f $value ]]; then
|
else
|
||||||
name="${name/_FILE/}"
|
value=${!name}
|
||||||
value=$(<$value)
|
|
||||||
fi
|
|
||||||
|
|
||||||
log "Replacing $name with $value ..."
|
|
||||||
find /data/ \
|
|
||||||
$dirExcludes \
|
|
||||||
-type f \
|
|
||||||
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
|
||||||
-or -name "*.conf" -or -name "*.properties" \) \
|
|
||||||
$fileExcludes \
|
|
||||||
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
|
||||||
fi
|
fi
|
||||||
done < <(env)
|
|
||||||
|
log "Replacing $name with $value ..."
|
||||||
|
|
||||||
|
value=${value//\\/\\\\}
|
||||||
|
value=${value//#/\\#}
|
||||||
|
|
||||||
|
find /data/ \
|
||||||
|
$dirExcludes \
|
||||||
|
-type f \
|
||||||
|
\( -name "*.yml" -or -name "*.yaml" -or -name "*.txt" -or -name "*.cfg" \
|
||||||
|
-or -name "*.conf" -or -name "*.properties" \) \
|
||||||
|
$fileExcludes \
|
||||||
|
-exec sed -i 's#${'"$name"'}#'"$value"'#g' {} \;
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@
|
exec ${SCRIPTS:-/}start-minecraftFinalSetup $@
|
||||||
|
|||||||
@@ -81,16 +81,23 @@ if [[ "$MODS" ]]; then
|
|||||||
do
|
do
|
||||||
if isURL $i; then
|
if isURL $i; then
|
||||||
log "Downloading mod/plugin $i ..."
|
log "Downloading mod/plugin $i ..."
|
||||||
effective_url=$(resolveEffectiveUrl "$i")
|
if isValidFileURL jar "$i"; then
|
||||||
if isValidFileURL jar "${effective_url}"; then
|
if ! curl -fsSL -o "${out_dir}/$(getFilenameFromUrl "${i}")" "${i}"; then
|
||||||
out_file=$(getFilenameFromUrl "${effective_url}")
|
|
||||||
if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then
|
|
||||||
log "ERROR: failed to download from $i into $out_dir"
|
log "ERROR: failed to download from $i into $out_dir"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "ERROR: $effective_url resolved from $i is not a valid jar URL"
|
effective_url=$(resolveEffectiveUrl "$i")
|
||||||
exit 2
|
if isValidFileURL jar "${effective_url}"; then
|
||||||
|
out_file=$(getFilenameFromUrl "${effective_url}")
|
||||||
|
if ! curl -fsSL -o "${out_dir}/$out_file" "${effective_url}"; then
|
||||||
|
log "ERROR: failed to download from $i into $out_dir"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
log "ERROR: $effective_url resolved from $i is not a valid jar URL"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
log "ERROR Invalid URL given in MODS: $i"
|
log "ERROR Invalid URL given in MODS: $i"
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
|
: ${SERVER_PROPERTIES:=/data/server.properties}
|
||||||
|
|
||||||
# FUNCTIONS
|
# FUNCTIONS
|
||||||
function setServerProp {
|
function setServerProp {
|
||||||
local prop=$1
|
local prop=$1
|
||||||
@@ -12,10 +14,15 @@ function setServerProp {
|
|||||||
TRUE|FALSE)
|
TRUE|FALSE)
|
||||||
var=${var,,} ;;
|
var=${var,,} ;;
|
||||||
esac
|
esac
|
||||||
log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
|
if grep "${prop}" "$SERVER_PROPERTIES" > /dev/null; then
|
||||||
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
|
log "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
|
||||||
|
sed -i "/^${prop}\s*=/ c ${prop}=${var//\\/\\\\}" "$SERVER_PROPERTIES"
|
||||||
|
else
|
||||||
|
log "Adding ${prop} with '${var}' in ${SERVER_PROPERTIES}"
|
||||||
|
echo "${prop}=${var//\\/\\\\}" >> "$SERVER_PROPERTIES"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
log "Skip setting ${prop}"
|
isDebugging && log "Skip setting ${prop}"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +76,7 @@ function customizeServerProps {
|
|||||||
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
|
setServerProp "max-world-size" "$MAX_WORLD_SIZE"
|
||||||
setServerProp "level-name" "$LEVEL"
|
setServerProp "level-name" "$LEVEL"
|
||||||
setServerProp "level-seed" "$SEED"
|
setServerProp "level-seed" "$SEED"
|
||||||
setServerProp "pvp" "$PVP"
|
setServerProp "pvp" "${PVP}"
|
||||||
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
|
setServerProp "generator-settings" "$GENERATOR_SETTINGS"
|
||||||
setServerProp "online-mode" "$ONLINE_MODE"
|
setServerProp "online-mode" "$ONLINE_MODE"
|
||||||
setServerProp "allow-flight" "$ALLOW_FLIGHT"
|
setServerProp "allow-flight" "$ALLOW_FLIGHT"
|
||||||
|
|||||||
@@ -4,6 +4,9 @@
|
|||||||
set -e
|
set -e
|
||||||
isDebugging && set -x
|
isDebugging && set -x
|
||||||
|
|
||||||
|
: ${LEVEL:=world}
|
||||||
|
export LEVEL
|
||||||
|
|
||||||
if [ $TYPE = "FEED-THE-BEAST" ]; then
|
if [ $TYPE = "FEED-THE-BEAST" ]; then
|
||||||
worldDest=$FTB_DIR/$LEVEL
|
worldDest=$FTB_DIR/$LEVEL
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -3,28 +3,40 @@
|
|||||||
. ${SCRIPTS:-/}start-utils
|
. ${SCRIPTS:-/}start-utils
|
||||||
|
|
||||||
if [ -n "$OPS" ]; then
|
if [ -n "$OPS" ]; then
|
||||||
log "Setting/adding ops"
|
log "Updating ops"
|
||||||
rm -rf /data/ops.txt.converted
|
rm -f /data/ops.txt.converted
|
||||||
echo $OPS | awk -v RS=, '{print}' > /data/ops.txt
|
echo $OPS | awk -v RS=, '{print}' > /data/ops.txt
|
||||||
|
|
||||||
|
if isTrue "${OVERRIDE_OPS}"; then
|
||||||
|
log "Recreating ops.json file at server startup"
|
||||||
|
rm -f /data/ops.json
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$WHITELIST" ]; then
|
if [ -n "$WHITELIST" ]; then
|
||||||
log "Setting whitelist"
|
log "Updating whitelist"
|
||||||
rm -rf /data/white-list.txt.converted
|
rm -f /data/white-list.txt.converted
|
||||||
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
|
echo $WHITELIST | awk -v RS=, '{print}' > /data/white-list.txt
|
||||||
|
|
||||||
|
if isTrue "${OVERRIDE_WHITELIST}"; then
|
||||||
|
log "Recreating whitelist.json file at server startup"
|
||||||
|
rm -f /data/whitelist.json
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$ICON" -a ! -e server-icon.png ]; then
|
if [ -n "$ICON" ]; then
|
||||||
log "Using server icon from $ICON..."
|
if [ ! -e server-icon.png ] || [ "${OVERRIDE_ICON}" == "TRUE" ]; then
|
||||||
# Not sure what it is yet...call it "img"
|
log "Using server icon from $ICON..."
|
||||||
curl -sSL -o /tmp/icon.img $ICON
|
# Not sure what it is yet...call it "img"
|
||||||
specs=$(identify /tmp/icon.img | awk '{print $2,$3}')
|
curl -sSL -o /tmp/icon.img $ICON
|
||||||
if [ "$specs" = "PNG 64x64" ]; then
|
specs=$(identify /tmp/icon.img | awk '{print $2,$3}')
|
||||||
mv /tmp/icon.img /data/server-icon.png
|
if [ "$specs" = "PNG 64x64" ]; then
|
||||||
else
|
mv /tmp/icon.img /data/server-icon.png
|
||||||
log "Converting image to 64x64 PNG..."
|
else
|
||||||
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
|
log "Converting image to 64x64 PNG..."
|
||||||
fi
|
convert /tmp/icon.img -resize 64x64! /data/server-icon.png
|
||||||
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
if ! isTrue ${SKIP_LOG4J_CONFIG}; then
|
||||||
@@ -72,7 +84,6 @@ if [ -n "$JVM_DD_OPTS" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if isTrue ${ENABLE_JMX}; then
|
if isTrue ${ENABLE_JMX}; then
|
||||||
: ${JMX_HOST:=0.0.0.0}
|
|
||||||
: ${JMX_PORT:=7091}
|
: ${JMX_PORT:=7091}
|
||||||
JVM_OPTS="${JVM_OPTS}
|
JVM_OPTS="${JVM_OPTS}
|
||||||
-Dcom.sun.management.jmxremote.local.only=false
|
-Dcom.sun.management.jmxremote.local.only=false
|
||||||
@@ -80,8 +91,8 @@ if isTrue ${ENABLE_JMX}; then
|
|||||||
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT}
|
-Dcom.sun.management.jmxremote.rmi.port=${JMX_PORT}
|
||||||
-Dcom.sun.management.jmxremote.authenticate=false
|
-Dcom.sun.management.jmxremote.authenticate=false
|
||||||
-Dcom.sun.management.jmxremote.ssl=false
|
-Dcom.sun.management.jmxremote.ssl=false
|
||||||
-Dcom.sun.management.jmxremote.host=${JMX_HOST}
|
-Dcom.sun.management.jmxremote.host=${JMX_BINDING:-0.0.0.0}
|
||||||
-Djava.rmi.server.hostname=${JMX_HOST}"
|
-Djava.rmi.server.hostname=${JMX_HOST:-localhost}"
|
||||||
|
|
||||||
log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}"
|
log "JMX is enabled. Make sure you have port forwarding for ${JMX_PORT}"
|
||||||
fi
|
fi
|
||||||
@@ -146,16 +157,21 @@ JVM_OPTS="-Xms${INIT_MEMORY} -Xmx${MAX_MEMORY} ${JVM_OPTS}"
|
|||||||
function copyFilesForCurseForge() {
|
function copyFilesForCurseForge() {
|
||||||
# copy player modification files unconditionally since their
|
# copy player modification files unconditionally since their
|
||||||
# processing into json is additive anyway
|
# processing into json is additive anyway
|
||||||
[ -f /data/ops.txt ] && cp -f /data/ops.txt ${FTB_DIR}/
|
[ -f /data/ops.txt ] && cp -f /data/ops.txt "${FTB_DIR}/"
|
||||||
[ -f /data/white-list.txt ] && cp -f /data/white-list.txt ${FTB_DIR}/
|
[ -f /data/white-list.txt ] && cp -f /data/white-list.txt "${FTB_DIR}/"
|
||||||
|
|
||||||
if [ ! -e "${FTB_DIR}/server-icon.png" -a -e /data/server-icon.png ]; then
|
if [ ! -e "${FTB_DIR}/server-icon.png" -a -e /data/server-icon.png ]; then
|
||||||
cp -f /data/server-icon.png ${FTB_DIR}/
|
cp -f /data/server-icon.png "${FTB_DIR}/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cp -f /data/eula.txt "${FTB_DIR}/"
|
cp -f /data/eula.txt "${FTB_DIR}/"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ! which java > /dev/null; then
|
||||||
|
log "Fixing PATH to include java"
|
||||||
|
PATH="${PATH}:/usr/bin"
|
||||||
|
fi
|
||||||
|
|
||||||
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s"
|
mcServerRunnerArgs="--stop-duration ${STOP_DURATION:-60}s"
|
||||||
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
if [[ ${TYPE} == "CURSE_INSTANCE" ]]; then
|
||||||
if isTrue ${DEBUG_EXEC}; then
|
if isTrue ${DEBUG_EXEC}; then
|
||||||
|
|||||||
17
start-utils
17
start-utils
@@ -144,8 +144,23 @@ requireVar() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
requireEnum() {
|
||||||
|
var=${1?}
|
||||||
|
shift
|
||||||
|
|
||||||
|
for allowed in $*; do
|
||||||
|
if [[ ${!var} = $allowed ]]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
log "ERROR: $var must be set to one of $@"
|
||||||
|
# exit 1
|
||||||
|
}
|
||||||
|
|
||||||
function writeEula() {
|
function writeEula() {
|
||||||
if ! echo "# Generated via Docker on $(date)
|
if ! echo "# Generated via Docker
|
||||||
|
# $(date)
|
||||||
eula=${EULA,,}
|
eula=${EULA,,}
|
||||||
" >/data/eula.txt; then
|
" >/data/eula.txt; then
|
||||||
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
|
||||||
|
|||||||
Reference in New Issue
Block a user