Commit 4b2084fa authored by Kekalainen's avatar Kekalainen

Initial commit

parents
Pipeline #128585471 passed with stage
in 1 minute and 18 seconds
image: docker:19.03.1
services:
- docker:19.03.1-dind
build:
stage: build
only:
- tags
variables:
IMAGE_TAG: $CI_REGISTRY_IMAGE:$CI_COMMIT_TAG
script:
- docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" "$CI_REGISTRY"
- docker build -t $IMAGE_TAG .
- docker push $IMAGE_TAG
FROM adoptopenjdk/openjdk8-openj9:alpine-slim
ENV MINECRAFT_EULA=false
ENV MINECRAFT_VERSION=1.15.2
RUN apk --no-cache add wget
WORKDIR /data
VOLUME /data
EXPOSE 25565
ADD entrypoint.sh /root/entrypoint.sh
RUN chmod +x /root/entrypoint.sh
ENTRYPOINT ["/root/entrypoint.sh"]
\ No newline at end of file
# PaperMC Docker
A lightweight Java 8 -based [PaperMC](https://papermc.io/) Minecraft server container.
## Running
You can run the server using the following command.
```sh
docker run -it -d --name papermc -e MINECRAFT_VERSION=1.15.2 -e MINECRAFT_EULA=false -p 25565:25565 kekalainen/papermc:latest
```
To start the server you'll need to signify your agreement to [Minecraft EULA](https://account.mojang.com/documents/minecraft_eula) by setting the `MINECRAFT_EULA` environment variable to `true`. The `MINECRAFT_VERSION` environment variable can be used to switch between different versions of Minecraft (which are downloaded during the first startup).
## Data persistence
A volume for the server files is created automatically. Alternatively it's possible to map the continer's `/data` directory to one on the host machine using the `-v /path/on/host:/data` flag.
\ No newline at end of file
#!/bin/sh
cd /data
if [ ! -f "./cache/patched_$MINECRAFT_VERSION.jar" ]; then
if [ ! -d "./cache" ]; then
mkdir ./cache
fi
wget -nv https://papermc.io/api/v1/paper/$MINECRAFT_VERSION/latest/download -O ./cache/paper_$MINECRAFT_VERSION.jar
java -jar -Dcom.mojang.eula.agree=false ./cache/paper_$MINECRAFT_VERSION.jar
rm ./cache/paper_$MINECRAFT_VERSION.jar ./cache/mojang_$MINECRAFT_VERSION.jar
fi
java -Dcom.mojang.eula.agree=$MINECRAFT_EULA -jar ./cache/patched_$MINECRAFT_VERSION.jar
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment