Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Commit

Permalink
Spigot built in image; readme reworked; docker-compose added
Browse files Browse the repository at this point in the history
  • Loading branch information
qdm12 committed Oct 27, 2018
1 parent 98e61f2 commit a611737
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 31 deletions.
31 changes: 23 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,27 @@
FROM openjdk:8-jre-alpine
FROM alpine:3.8 AS builder
RUN echo https://dl-3.alpinelinux.org/alpine/v3.8/community > /etc/apk/repositories && \
echo https://dl-3.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk --update add openjdk8-jre git wget ca-certificates
RUN wget -q https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
#RUN git config --global --unset core.autocrlf
RUN java -jar BuildTools.jar --rev 1.13.2

FROM alpine:3.8
LABEL maintainer="quentin.mcgaw@gmail.com" \
description="VPN client container to private internet access servers based on Alpine Linux and OpenVPN" \
download="53.9MB" \
size="?MB" \
description="Lightweight Minecraft Spigot 1.13.2 server container" \
download="?MB" \
size="132MB" \
ram="300MB" \
cpu_usage="Medium" \
github="https://github.com/qdm12/spigot-docker"
RUN mkdir /spigot
ENV JAVA_OPTS -Xms512m -Xmx1800m
ENTRYPOINT java -jar /spigot/spigot-1.12.2.jar
CMD ["nogui"]
RUN echo https://dl-3.alpinelinux.org/alpine/v3.8/community > /etc/apk/repositories && \
echo https://dl-3.alpinelinux.org/alpine/v3.8/main >> /etc/apk/repositories && \
apk --update add openjdk8-jre
ENV JAVA_OPTS -Xms512m -Xmx1800m -XX:+UseConcMarkSweepGC
COPY --from=builder /spigot-1.13.2.jar .
ENV ACCEPT_EULA=false
VOLUME /spigot
WORKDIR /spigot
ENTRYPOINT [ ! -f ../spigot-1.13.2.jar ] || mv ../spigot-1.13.2.jar ./ && \
[ "$ACCEPT_EULA" != "true" ] || echo "eula=true" > eula.txt && \
java -jar spigot-1.13.2.jar nogui
55 changes: 32 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,56 @@
# Spigot Docker

*Lightweight Minecraft Spigot 1.13.2 server container*

[![Spigot Docker](https://github.com/qdm12/spigot-docker/raw/master/readme/title.png)](https://hub.docker.com/r/qmcgaw/spigot)

[![Build Status](https://travis-ci.org/qdm12/spigot-docker.svg?branch=master)](https://travis-ci.org/qdm12/spigot-docker)
[![Docker Build Status](https://img.shields.io/docker/build/qmcgaw/spigot.svg)](https://hub.docker.com/r/qmcgaw/spigot)

[![GitHub last commit](https://img.shields.io/github/last-commit/qdm12/spigot-docker.svg)](https://github.com/qdm12/spigot-docker/issues)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/y/qdm12/spigot-docker.svg)](https://github.com/qdm12/spigot-docker/issues)
[![GitHub issues](https://img.shields.io/github/issues/qdm12/spigot-docker.svg)](https://github.com/qdm12/spigot-docker/issues)

[![](https://images.microbadger.com/badges/image/qmcgaw/spigot.svg)](https://microbadger.com/images/qmcgaw/spigot)
[![](https://images.microbadger.com/badges/version/qmcgaw/spigot.svg)](https://microbadger.com/images/qmcgaw/spigot)
[![Docker Pulls](https://img.shields.io/docker/pulls/qmcgaw/spigot.svg)](https://hub.docker.com/r/qmcgaw/spigot)
[![Docker Stars](https://img.shields.io/docker/stars/qmcgaw/spigot.svg)](https://hub.docker.com/r/qmcgaw/spigot)
[![Docker Automated](https://img.shields.io/docker/automated/qmcgaw/spigot.svg)](https://hub.docker.com/r/qmcgaw/spigot)

[![Image size](https://images.microbadger.com/badges/image/qmcgaw/spigot.svg)](https://microbadger.com/images/qmcgaw/spigot)
[![Image version](https://images.microbadger.com/badges/version/qmcgaw/spigot.svg)](https://microbadger.com/images/qmcgaw/spigot)

| Download size | Image size | RAM usage | CPU usage |
| --- | --- | --- | --- |
| 53.9MB | ?MB | 300MB | Medium |
| ?MB | 132MB | 300MB | Medium |

Based on:
- Alpine Linux
- OpenJDK JRE 8

## Installation
- Alpine Linux 3.8
- OpenJDK JRE 8

### Spigot MC
## Setup

[![Spigot](https://github.com/qdm12/spigot-docker/raw/master/readme/spigot.png)](https://www.spigotmc.org)

- Option 1 of 2: Create a Spigot Server from nothing
1. Download the latest [Buildtools](https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar).
1. Follow the instructions to build **spigot-X.XX.X.jar** on [https://www.spigotmc.org/wiki/buildtools/](https://www.spigotmc.org/wiki/buildtools/) on your machine.
1. From here, let the host path to your Spigot MC server directory be `/yourpath/spigot`.
1. Once the **spigot-X.XX.X.jar** is created, move it in the directory `/yourpath/spigot`.
1. In the directory `my/path/spigot`, create a file *eula.txt* with the content `eula=true` to accept the SpigotMC license.
- Option 2 of 2: You already have a Spigot MC server directory
1. From here, let the host path to your Spigot MC server directory be `/yourpath/spigot`
1. Move your server files to `/yourpath/spigot`

### Launching the Docker container

Enter the following and change `yourpath` and optionally the port mapping `25565:25565`
### Server launch

```bash
sudo docker run -d --name=spigot --restart=always -p 25565:25565 \
-v '/yourpath/spigot:/spigot' qmcgaw/spigot
docker run -d --name=spigot -p 25565:25565/tcp \
-v './spigot:/spigot' -e ACCEPT_EULA=true qmcgaw/spigot
```

### Others
or with `docker-compose up -d` using the [docker-compose.yml](https://github.com/qdm12/spigot-docker/raw/master/docker-compose.yml) file.

The environment variable `ACCEPT_EULA` is used to accept the SpigotMC EULA license (required to run the server).

If you have existing server data, simply place it in `./spigot` then launch the container as described above.

## TODOs

- Execute commands in server
- Stop server gracefully
- Healthcheck
- Stop procedure
- Plugins

I recommend using the [Hibernate plugin](https://www.spigotmc.org/resources/hibernate.4441/) for your Spigot Docker server

Expand Down
14 changes: 14 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: '3'
services:
spigot:
build: .
image: qmcgaw/spigot
container_name: spigot
volumes:
- ./spigot:/spigot
network_mode: bridge
ports:
- 25565:25565/tcp
environment:
- ACCEPT_EULA=true
restart: always

0 comments on commit a611737

Please sign in to comment.