Compare commits
5 Commits
1.16.5-36.
...
62c4ef86af
| Author | SHA1 | Date | |
|---|---|---|---|
| 62c4ef86af | |||
| 60943d2f82 | |||
| c7328f43c2 | |||
| 0dd98315e5 | |||
| 5be6e30444 |
@@ -3,3 +3,4 @@
|
||||
.gitignore
|
||||
.gitlab-ci.yml
|
||||
README.md
|
||||
build.sh
|
||||
|
||||
@@ -10,14 +10,13 @@ variables:
|
||||
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
|
||||
- apk add bash
|
||||
after_script:
|
||||
- docker logout hub.docker.com
|
||||
|
||||
@@ -25,43 +24,4 @@ after_script:
|
||||
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
|
||||
- bash build.sh
|
||||
|
||||
11
README.md
11
README.md
@@ -12,7 +12,15 @@ docker run -p 25565:25565 rehashedsalt/minecraft-forge:1.16.5-36.1.4-1.0.0
|
||||
|
||||
And badda bing, badda boom, you'll have a Minecraft Forge server of whatever the tag is.
|
||||
|
||||
For obvious reason, you **should never use the :latest tag!**
|
||||
The "latest" tag of each version of Minecraft is somewhere along the lines of "1.16.5-36.1.14-master". See Dockerhub for more info.
|
||||
|
||||
## Server Console
|
||||
|
||||
You can access the server console in a screen session pretty easily:
|
||||
|
||||
```bash
|
||||
docker exec -it mycontainer screen -r minecraft
|
||||
```
|
||||
|
||||
## Application State
|
||||
|
||||
@@ -31,6 +39,7 @@ 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
|
||||
`FORGE_PACK_ZIP`|If provided, the URL to a zip or tar.gz file that contains the modpack that needs to be installed. Will be intelligently extracted into the server directory through the magic of `find`.
|
||||
`CONFIG_REPO`|If provided, the URI to a git repository that contains configuration to copy over top the pack. The root of the repo will be the root of the server directory.
|
||||
`ARGS`|Any additional arguments to be passed to the JVM
|
||||
|
||||
## Useful Arguments
|
||||
|
||||
33
build.sh
Executable file
33
build.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#! /bin/bash
|
||||
#
|
||||
# Build the Docker image for a series of different Forge versions
|
||||
#
|
||||
|
||||
# MC version list
|
||||
declare -a mcversions=(
|
||||
"1.12.2"
|
||||
"1.16.5"
|
||||
)
|
||||
|
||||
# Forge version dictionary (we only support one version per)
|
||||
declare -A forgeversions=(
|
||||
["1.12.2"]="14.23.5.2855"
|
||||
["1.16.5"]="36.1.13"
|
||||
)
|
||||
|
||||
# Build images
|
||||
docker buildx create --use
|
||||
for mc in ${mcversions[@]}; do
|
||||
forge="${forgeversions[$mc]}"
|
||||
echo "Building image for Minecraft $mc, Forge $forge, CI_COMMIT_REF_NAME of $CI_COMMIT_REF_NAME"
|
||||
# --no-cache is required for clean builds
|
||||
docker buildx build \
|
||||
--build-arg MINECRAFT_VERSION="$mc" \
|
||||
--build-arg FORGE_VERSION="$forge" \
|
||||
--no-cache \
|
||||
--platform linux/amd64 \
|
||||
--tag "$CI_HUB_USERNAME/$CI_PROJECT_NAME:$mc-$forge-${CI_COMMIT_REF_NAME:=bleeding}" \
|
||||
--push \
|
||||
.
|
||||
done
|
||||
docker images
|
||||
@@ -20,6 +20,17 @@ if [ -n "$FORGE_PACK_ZIP" ]; then
|
||||
popd > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Then also download and extract a config repo, if one exists
|
||||
if [ -n "$CONFIG_REPO" ]; then
|
||||
echo "Downloading config repo: $CONFIG_REPO"
|
||||
tmpdir="$(mktemp -d)"
|
||||
pushd "$tmpdir" > /dev/null 2>&1
|
||||
git clone "$CONFIG_REPO" .
|
||||
rm -rf .git
|
||||
rsync -av ./ /minecraft/
|
||||
popd > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
# Entrypoint will be server.jar
|
||||
args="-jar server.jar nogui"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user