Overhaul for get-server v. 2.0.0

Since get-server downloads its own jarfile this commit overhauls a lot
of the minecraft deploy to match the new strategy. It also updates the
README and adds makefile targets for a few new commands.
This commit is contained in:
ducoterra
2021-11-02 10:05:01 -04:00
parent 8d190e478f
commit d181d452e8
5 changed files with 24 additions and 71 deletions

3
.gitignore vendored
View File

@@ -1 +1,2 @@
data/
data/
world/

View File

@@ -1,27 +1,13 @@
SHELL := /bin/bash
IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION)
IMAGE_LATEST ?= $(shell cat IMAGE):latest
PWD ?= $(shell pwd)
include .gitlab/Makefile
.PHONY: buildx-context
buildx-context:
docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64
.PHONY: buildx-clear
buildx-clear:
docker buildx rm arm64
.PHONY: build
build:
docker buildx build --load . -t $(IMAGE)
@docker buildx build --load . -t $(IMAGE_LATEST)
.PHONY: push
push:
docker buildx build --platform linux/amd64 --push . -t $(IMAGE)
@docker buildx build --platform linux/amd64 --push . -t $(IMAGE_LATEST)
.PHONY: get-server
get-server:
@mkdir -p world
@echo 'eula=true' > world/eula.txt
@docker run -it -e SERVER_VERSION=1.17.1 -v $(PWD)/world:/downloads ducoterra/get-minecraft:latest
.PHONY: run
run:
docker run -it -v $(PWD):/mc_data $(IMAGE) bash
docker-compose run --service-ports minecraft

View File

@@ -1,61 +1,34 @@
# Minecraft
## Getting server.jar
![Click Installations](img/main.png)
![Select the Options Menu](img/menu.png)
![Click Edit](img/edit.png)
![Click Download Server](img/server.png)
## Running Locally
```bash
docker-compose build minecraft
docker-compose up minecraft
# download the most recent version of minecraft
make get-server
# Run the server
docker-compose up
```
## Uploading to Docker Hub
In docker-compose.yaml, update the image tag to:
1. Update the version in the VERSION file.
2. Build and push the new version
```yaml
...
services:
minecraft:
build: .
image: <your_username>/minecraft:<version>-1
ports:
...
```
then run
```bash
docker-compose push
```
```bash
make build
make push
```
## Running in kubernetes
In k8s/deploy.yaml, edit the deploy
```yaml
...
spec:
containers:
- name: minecraft
image: <your image from above>
ports:
...
```
Then run the following
Requires helm v3. Edit values.yaml and run the following:
```bash
kubectl apply -f k8s/pvc
kubectl apply -f k8s
helm upgrade --install minecraft
```
Your minecraft server will be available on port 25565
Your minecraft server will be available on port 25565 by default.
## Create a Backup

View File

@@ -23,13 +23,6 @@ spec:
volumeMounts:
- mountPath: /downloads
name: data
- name: download-server
image: {{ .Values.get_server.image }}
imagePullPolicy: Always
command: ["bash", "-c", "curl -o server.jar $(cat SERVER_VERSION)"]
volumeMounts:
- mountPath: /downloads
name: data
containers:
- name: {{ .Release.Name }}
image: {{ .Values.image }}

View File

@@ -1,6 +1,6 @@
image: ducoterra/minecraft:latest
get_server:
image: ducoterra/get-minecraft:latest
image: ducoterra/get-minecraft:2.0.0
server_version: "1.17.1"
port: 20101
max_cpu: 4