Initial test build. Looks like everything works
This commit is contained in:
parent
690301722c
commit
7a6404b861
5
.dockerignore
Normal file
5
.dockerignore
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.swp
|
||||||
|
.git
|
||||||
|
.gitignore
|
||||||
|
.gitlab-ci.yml
|
||||||
|
README.md
|
67
.gitlab-ci.yml
Normal file
67
.gitlab-ci.yml
Normal file
@ -0,0 +1,67 @@
|
|||||||
|
#
|
||||||
|
# This guy is awesome: https://dev.to/bzinoun/gitlab-ci-to-build-and-push-containers-to-registry-538a
|
||||||
|
#
|
||||||
|
|
||||||
|
image: morlay/buildx:607a2ce
|
||||||
|
variables:
|
||||||
|
# DinD's vfs driver is pretty intensive; this is less so
|
||||||
|
DOCKER_DRIVER: overlay2
|
||||||
|
CI_HUB_USERNAME: rehashedsalt
|
||||||
|
CI_PROJECT_NAME: minecraft-forge
|
||||||
|
stages:
|
||||||
|
- build
|
||||||
|
# - test
|
||||||
|
- push
|
||||||
|
services:
|
||||||
|
- docker:dind
|
||||||
|
before_script:
|
||||||
|
- echo -n "$CI_LOGIN_PASSWORD" | docker login -u "$CI_LOGIN_USERNAME" --password-stdin
|
||||||
|
- docker version
|
||||||
|
- docker info
|
||||||
|
after_script:
|
||||||
|
- docker logout hub.docker.com
|
||||||
|
|
||||||
|
# BUILD
|
||||||
|
Build:
|
||||||
|
stage: build
|
||||||
|
script:
|
||||||
|
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest || true
|
||||||
|
- docker buildx create --use
|
||||||
|
- >
|
||||||
|
docker buildx build
|
||||||
|
--pull
|
||||||
|
--platform linux/amd64
|
||||||
|
--cache-from $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
|
||||||
|
--tag $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
--push
|
||||||
|
.
|
||||||
|
- docker images
|
||||||
|
|
||||||
|
# PUSH
|
||||||
|
Push_When_Tag:
|
||||||
|
stage: push
|
||||||
|
only:
|
||||||
|
- tags
|
||||||
|
script:
|
||||||
|
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
- >
|
||||||
|
docker tag
|
||||||
|
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
|
||||||
|
- >
|
||||||
|
docker tag
|
||||||
|
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
$CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
|
||||||
|
- docker images
|
||||||
|
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_REF_NAME
|
||||||
|
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:latest
|
||||||
|
Push_Bleeding:
|
||||||
|
stage: push
|
||||||
|
script:
|
||||||
|
- docker pull $CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
- >
|
||||||
|
docker tag
|
||||||
|
$CI_HUB_USERNAME/$CI_PROJECT_NAME:$CI_COMMIT_SHORT_SHA
|
||||||
|
$CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
|
||||||
|
- docker images
|
||||||
|
- docker push $CI_HUB_USERNAME/$CI_PROJECT_NAME:bleeding
|
23
Dockerfile
Normal file
23
Dockerfile
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# The first stage just builds up the modpack
|
||||||
|
FROM alpine:latest AS build
|
||||||
|
|
||||||
|
# Args
|
||||||
|
ARG MINECRAFT_VERSION="1.16.5"
|
||||||
|
ARG FORGE_VERSION="36.1.4"
|
||||||
|
|
||||||
|
# The actual setup work
|
||||||
|
COPY start-server.sh /minecraft/start-server.sh
|
||||||
|
WORKDIR /minecraft
|
||||||
|
RUN apk add curl openjdk8-jre &&\
|
||||||
|
curl -L "https://files.minecraftforge.net/maven/net/minecraftforge/forge/${MINECRAFT_VERSION}-${FORGE_VERSION}/forge-${MINECRAFT_VERSION}-${FORGE_VERSION}-installer.jar" -o installer.jar &&\
|
||||||
|
java -jar installer.jar --installServer &&\
|
||||||
|
echo "eula=true" > eula.txt &&\
|
||||||
|
rm installer.jar installer.jar.log && \
|
||||||
|
ln -s "forge-${MINECRAFT_VERSION}-${FORGE_VERSION}.jar" server.jar
|
||||||
|
|
||||||
|
# The second stage is the actual container
|
||||||
|
FROM openjdk:8
|
||||||
|
WORKDIR /minecraft
|
||||||
|
COPY --from=build /minecraft .
|
||||||
|
CMD [ "bash", "start-server.sh" ]
|
||||||
|
EXPOSE 25565
|
52
README.md
Normal file
52
README.md
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
# docker-minecraft
|
||||||
|
|
||||||
|
A Dockerfile and some assorted scripts to build a Minecraft Forge server container.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
Deploy as expected:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
docker run -p 25565:25565 rehashedsalt/minecraft-forge
|
||||||
|
```
|
||||||
|
|
||||||
|
And badda bing, badda boom, you'll have a Minecraft Forge server of whatever the latest stable is.
|
||||||
|
|
||||||
|
## Application State
|
||||||
|
|
||||||
|
For obvious reasons, you'll want to consult the documentation of any mods you have installed, but a majority of application state lives here-ish:
|
||||||
|
|
||||||
|
* `/minecraft/world`
|
||||||
|
|
||||||
|
* `/minecraft/ops.json`, `whitelist.json`, `banned-ips.json`, `banned-players.json`, etc.
|
||||||
|
|
||||||
|
* `/minecraft/logs`
|
||||||
|
|
||||||
|
## Environment Variables
|
||||||
|
|
||||||
|
variable|description
|
||||||
|
---|---
|
||||||
|
`JRE_XMX`|Maximum amount of heap passed to the main Minecraft process
|
||||||
|
`JRE_XMS`|Minimum heap size passed to the main Minecraft process
|
||||||
|
`ARGS`|Any additional arguments to be passed to the JVM
|
||||||
|
|
||||||
|
## Useful Arguments
|
||||||
|
|
||||||
|
The following arguments may be useful to pass through `$ARGS` from time to time:
|
||||||
|
|
||||||
|
* `-Dfml.queryResult=confirm` - Useful when confirming through world corruption
|
||||||
|
|
||||||
|
## Weird Defaults
|
||||||
|
|
||||||
|
The default `server.properties` contains the following changes to better facilitate usage in a modded environment:
|
||||||
|
|
||||||
|
```
|
||||||
|
allow-flight=true
|
||||||
|
difficulty=hard
|
||||||
|
enable-command-block=true
|
||||||
|
spawn-protection=0
|
||||||
|
```
|
||||||
|
|
||||||
|
## License
|
||||||
|
|
||||||
|
MIT
|
52
server.properties
Normal file
52
server.properties
Normal file
@ -0,0 +1,52 @@
|
|||||||
|
#Minecraft server properties
|
||||||
|
#Fri Apr 09 16:05:21 CDT 2021
|
||||||
|
allow-flight=true
|
||||||
|
allow-nether=true
|
||||||
|
broadcast-console-to-ops=true
|
||||||
|
broadcast-rcon-to-ops=true
|
||||||
|
difficulty=hard
|
||||||
|
enable-command-block=true
|
||||||
|
enable-jmx-monitoring=false
|
||||||
|
enable-query=false
|
||||||
|
enable-rcon=false
|
||||||
|
enable-status=true
|
||||||
|
enforce-whitelist=false
|
||||||
|
entity-broadcast-range-percentage=100
|
||||||
|
force-gamemode=false
|
||||||
|
function-permission-level=2
|
||||||
|
gamemode=survival
|
||||||
|
generate-structures=true
|
||||||
|
generator-settings=
|
||||||
|
hardcore=false
|
||||||
|
level-name=world
|
||||||
|
level-seed=
|
||||||
|
level-type=default
|
||||||
|
max-build-height=256
|
||||||
|
max-players=20
|
||||||
|
max-tick-time=60000
|
||||||
|
max-world-size=29999984
|
||||||
|
motd=A Minecraft Server
|
||||||
|
network-compression-threshold=256
|
||||||
|
online-mode=true
|
||||||
|
op-permission-level=4
|
||||||
|
player-idle-timeout=0
|
||||||
|
prevent-proxy-connections=false
|
||||||
|
pvp=true
|
||||||
|
query.port=25565
|
||||||
|
rate-limit=0
|
||||||
|
rcon.password=
|
||||||
|
rcon.port=25575
|
||||||
|
resource-pack=
|
||||||
|
resource-pack-sha1=
|
||||||
|
server-ip=
|
||||||
|
server-port=25565
|
||||||
|
snooper-enabled=true
|
||||||
|
spawn-animals=true
|
||||||
|
spawn-monsters=true
|
||||||
|
spawn-npcs=true
|
||||||
|
spawn-protection=0
|
||||||
|
sync-chunk-writes=true
|
||||||
|
text-filtering-config=
|
||||||
|
use-native-transport=true
|
||||||
|
view-distance=10
|
||||||
|
white-list=false
|
23
start-server.sh
Executable file
23
start-server.sh
Executable file
@ -0,0 +1,23 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
#
|
||||||
|
# start-server.sh
|
||||||
|
# Copyright (C) 2021 Vintage Salt <rehashedsalt@cock.li>
|
||||||
|
#
|
||||||
|
# Distributed under terms of the MIT license.
|
||||||
|
#
|
||||||
|
|
||||||
|
# Entrypoint will be server.jar
|
||||||
|
args="-jar server.jar nogui"
|
||||||
|
|
||||||
|
# Memory configuration
|
||||||
|
[ -n "$JRE_XMX" ] && args="-Xmx$JRE_XMX $args"
|
||||||
|
[ -n "$JRE_XMS" ] && args="-Xms$JRE_XMS $args"
|
||||||
|
[ -n "$ARGS" ] && args="$ARGS $args"
|
||||||
|
|
||||||
|
# Debugging info
|
||||||
|
java -version
|
||||||
|
echo "Invoking java with args: $args"
|
||||||
|
|
||||||
|
# Start 'er up
|
||||||
|
java $args
|
||||||
|
|
Loading…
Reference in New Issue
Block a user