First commit

master
Chris Kankiewicz 2014-11-16 01:10:45 -07:00
commit eac546f3be
5 changed files with 90 additions and 0 deletions

1
.dockerignore Normal file
View File

@ -0,0 +1 @@
.git

36
Dockerfile Normal file
View File

@ -0,0 +1,36 @@
FROM ubuntu:14.04
MAINTAINER Chris Kankiewicz <Chris@ChrisKankiewicz.com>
## Perform apt update / upgrade
RUN apt-get update && apt-get -y upgrade
## Install Minecraft dependencies
RUN apt-get -y install openjdk-7-jre-headless
## Create Minecraft directry
RUN mkdir /srv/minecraft
## Download and install the Minecraft server deb
ADD https://s3.amazonaws.com/Minecraft.Download/versions/1.8/minecraft_server.1.8.jar /srv/minecraft/minecraft_server.jar
## Add the EULA file
ADD files/eula.txt /srv/minecraft/eula.txt
## Perform apt cleanup
RUN apt-get -y autoremove && apt-get -y clean && apt-get -y autoclean
## Add and chmod the run file
ADD files/run.sh /srv/minecraft/run.sh
RUN chmod +x /srv/minecraft/run.sh
## Define docker volumes
VOLUME /srv/minecraft
## Expose ports
EXPOSE 25565
## Set the working dir
WORKDIR /srv/minecraft
## Default command
CMD ["./run.sh", "minecraft_server.jar"]

32
README.md Normal file
View File

@ -0,0 +1,32 @@
docker-minecraft
===================
Docker container for Minecraft server.
### Running the container
docker run -d -p 25565:25565 -e OP=player_name -v /srv/minecraft --name Minecraft phlak/minecraft
-----
**Copyright (c) 2014 Chris Kankewicz <Chris@ChrisKankiewicz.com>**
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.

1
files/eula.txt Normal file
View File

@ -0,0 +1 @@
eula=true

20
files/run.sh Normal file
View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
## Get the scripts path
SCRIPT_PATH="$(dirname $(readlink -f ${0}))"
## Require argument
if [[ -z "${1}" ]]; then
echo "Usage: $(basename ${0}) [MINECRAFT_SERVER_JAR]"; exit 1
fi
## Set server directory
SERVER_DIR="$(dirname ${1})"
## Add OP user
if [[ ! -e "${SERVER_DIR}/ops.txt.converted" ]]; then
echo "${OP}" > ${SERVER_DIR}/ops.txt || exit 1
fi
## Launch Minecraft
java -Xms256M -Xmx2048M -jar ${1} nogui