clean history
This commit is contained in:
commit
8fb9a0d8a8
41
.drone.yml
Normal file
41
.drone.yml
Normal file
@ -0,0 +1,41 @@
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Minecraft Vanilla Server
|
||||
|
||||
steps:
|
||||
- name: build private
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: docker-registry.pyas.de/games/minecraft-vanilla-server
|
||||
registry: docker-registry.pyas.de
|
||||
dockerfile: ./Dockerfile
|
||||
tags:
|
||||
- latest
|
||||
- ${MINECRAFT_SERVER_VERSION}
|
||||
build_args_from_env:
|
||||
- MINECRAFT_SERVER_VERSION
|
||||
- DOWNLOAD_URL
|
||||
depends_on:
|
||||
- clone
|
||||
|
||||
- name: build public
|
||||
image: plugins/docker
|
||||
settings:
|
||||
repo: kimdrechsel/minecraft-vanilla-server
|
||||
username: kimdrechsel
|
||||
registry: docker.io
|
||||
password:
|
||||
from_secret: dockerhub_token
|
||||
dockerfile: ./Dockerfile
|
||||
tags:
|
||||
- latest
|
||||
- ${MINECRAFT_SERVER_VERSION}
|
||||
build_args_from_env:
|
||||
- MINECRAFT_SERVER_VERSION
|
||||
- DOWNLOAD_URL
|
||||
depends_on:
|
||||
- clone
|
||||
|
||||
trigger:
|
||||
event:
|
||||
- custom
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/.idea
|
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@ -0,0 +1,34 @@
|
||||
FROM openjdk:18-jdk-alpine3.13
|
||||
LABEL maintainer="Kim Oliver Drechsel kim@drechsel.xyz"
|
||||
|
||||
ARG MINECRAFT_SERVER_VERSION
|
||||
ARG DOWNLOAD_URL
|
||||
|
||||
LABEL org.opencontainers.image.authors="Kim Oliver Drechsel kim@drechsel.xyz"
|
||||
LABEL org.opencontainers.image.version="$MINECRAFT_SERVER_VERSION"
|
||||
LABEL org.opencontainers.image.description="Minecraft Vanilla Server Java Edition based on the official Java JDK 18 image running on Alpine."
|
||||
LABEL org.opencontainers.image.base.name="hub.docker.com/openjdk:18-jdk-alpine3.13"
|
||||
LABEL org.opencontainers.image.title="Minecraft Vanilla Server Java Edition"
|
||||
|
||||
RUN apk update && \
|
||||
apk add --no-cache --update coreutils && \
|
||||
apk add --no-cache --update tzdata curl unzip bash
|
||||
|
||||
ENV TZ=Europe/Berlin
|
||||
ENV MINECRAFT_SERVER_VERSION="$MINECRAFT_SERVER_VERSION"
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
VOLUME /app/world
|
||||
VOLUME /app
|
||||
|
||||
ADD $DOWNLOAD_URL /opt/server.jar
|
||||
COPY app /app
|
||||
|
||||
RUN chmod 755 /app/entrypoint.sh
|
||||
RUN echo "eula=true" > /app/eula.txt
|
||||
|
||||
EXPOSE 25565/tcp
|
||||
|
||||
ENTRYPOINT [ "/app/entrypoint.sh" ]
|
||||
CMD [ "java", "-Xmx4G", "-jar", "server.jar", "nogui" ]
|
9
LICENSE
Normal file
9
LICENSE
Normal file
@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2021 Kim Oliver Drechsel <kim@drechsel.xyz>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
33
README.md
Normal file
33
README.md
Normal file
@ -0,0 +1,33 @@
|
||||
# Minecraft-Vanilla-Server
|
||||
|
||||
Minecraft Vanilla Server Java Edition on Docker
|
||||
|
||||
[![Build Status](https://drone.pyas.de/api/badges/Games/Minecraft-Vanilla-Server/status.svg)](https://drone.pyas.de/Games/Minecraft-Vanilla-Server)
|
||||
|
||||
This Repository is mirrored from my [Gitea instance](https://git.pyas.de/Games/Minecraft-Vanilla-Server).
|
||||
|
||||
## Image
|
||||
This image is based on the official Java JDK 18 image running on an Alpine image.
|
||||
|
||||
For the Image on Docker Hub see [here](https://hub.docker.com/r/kimdrechsel/minecraft-vanilla-server).
|
||||
|
||||
## Run
|
||||
### Latest version
|
||||
|
||||
`docker run -p 25565:25565 kimdrechsel/minecraft-vanilla-server:latest`
|
||||
|
||||
### Specific version
|
||||
|
||||
`docker run -p 25565:25565 kimdrechsel/minecraft-vanilla-server:1.18`
|
||||
|
||||
## Server.jar
|
||||
The latest `server.jar` gets
|
||||
1. stored to `/opt` in the docker image
|
||||
2. and symlinked to `/app/server.jar`
|
||||
|
||||
## Volumes
|
||||
- `/app` contains server-related files
|
||||
- `/app/world` contains the world data
|
||||
|
||||
## Automated image building for new Releases
|
||||
New images with the corresponding version as it's tag are created automatically when a new Minecraft server version is released (Checks run every 30 minutes).
|
34
app/entrypoint.sh
Executable file
34
app/entrypoint.sh
Executable file
@ -0,0 +1,34 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
trap "echo Exiting...; exit 0" EXIT TERM
|
||||
|
||||
if [ "$1" = 'java' ]; then
|
||||
|
||||
BASE_DIR="/app"
|
||||
|
||||
if ! [ -d "$BASE_DIR" ]; then
|
||||
mkdir "$BASE_DIR"
|
||||
fi
|
||||
|
||||
cd "$BASE_DIR"
|
||||
|
||||
if ! test -f $BASE_DIR/server.properties; then
|
||||
echo "Preparing Server Files..."
|
||||
fi
|
||||
|
||||
echo "eula=true" > $BASE_DIR/eula.txt
|
||||
|
||||
|
||||
if test -f /opt/server.jar; then
|
||||
ln -sf /opt/server.jar $BASE_DIR/server.jar
|
||||
else
|
||||
echo server.jar not found
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Starting Server Version $MINECRAFT_SERVER_VERSION..."
|
||||
exec "$@"
|
||||
fi
|
||||
|
||||
exec "$@"
|
25
version_checker.sh
Executable file
25
version_checker.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This Script checks for new Minecraft Vanilla Server Version on the Mojang Website
|
||||
# and (if a new Version got published) creates a new build via Drone CI Command Line Tool
|
||||
|
||||
USER_AGENT="user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/88.0.4324.182 Safari/537.36"
|
||||
|
||||
HTML=$(curl -s -H "$USER_AGENT" https://www.minecraft.net/de-de/download/server | grep -e "server.jar")
|
||||
LATEST_VERSION=$(echo "$HTML" | grep -oe "minecraft_server.*.jar" | head -n1 | sed -e 's/minecraft_server.//' | sed -e 's/.jar//')
|
||||
EXISTING_VERSIONS=$(curl -L -s 'https://registry.hub.docker.com/v2/repositories/kimdrechsel/minecraft-vanilla-server/tags?page_size=1024' | jq '.results[]["name"]' | tr -d \")
|
||||
|
||||
if [ -z "$LATEST_VERSION" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! echo "$EXISTING_VERSIONS" | grep -q "$LATEST_VERSION" || [[ "$1" == "-f" ]]; then
|
||||
echo "New Server Version found: $LATEST_VERSION"
|
||||
|
||||
DOWNLOAD_URL=$(echo "$HTML" | grep -oe "https://launcher.mojang.com.*server.jar")
|
||||
|
||||
build_number=$(/usr/local/bin/drone build create --param MINECRAFT_SERVER_VERSION="$TAG_VERSION" --param DOWNLOAD_URL="$DOWNLOAD_URL" Games/Minecraft-Vanilla-Server | grep Number | cut -d' ' -f2)
|
||||
echo "Starting build pipeline at
|
||||
https://drone.pyas.de/Games/Minecraft-Vanilla-Server/$build_number"
|
||||
|
||||
fi
|
Loading…
Reference in New Issue
Block a user