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:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1 +1,2 @@
|
|||||||
data/
|
data/
|
||||||
|
world/
|
||||||
|
|||||||
28
Makefile
28
Makefile
@@ -1,27 +1,13 @@
|
|||||||
SHELL := /bin/bash
|
SHELL := /bin/bash
|
||||||
|
|
||||||
IMAGE ?= $(shell cat IMAGE):$(shell cat VERSION)
|
include .gitlab/Makefile
|
||||||
IMAGE_LATEST ?= $(shell cat IMAGE):latest
|
|
||||||
PWD ?= $(shell pwd)
|
|
||||||
|
|
||||||
.PHONY: buildx-context
|
.PHONY: get-server
|
||||||
buildx-context:
|
get-server:
|
||||||
docker buildx create --name arm64 --use --platform linux/amd64,linux/arm64
|
@mkdir -p world
|
||||||
|
@echo 'eula=true' > world/eula.txt
|
||||||
.PHONY: buildx-clear
|
@docker run -it -e SERVER_VERSION=1.17.1 -v $(PWD)/world:/downloads ducoterra/get-minecraft:latest
|
||||||
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: run
|
.PHONY: run
|
||||||
run:
|
run:
|
||||||
docker run -it -v $(PWD):/mc_data $(IMAGE) bash
|
docker-compose run --service-ports minecraft
|
||||||
|
|||||||
51
README.md
51
README.md
@@ -1,61 +1,34 @@
|
|||||||
# Minecraft
|
# Minecraft
|
||||||
|
|
||||||
## Getting server.jar
|
|
||||||
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
|
|
||||||
## Running Locally
|
## Running Locally
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker-compose build minecraft
|
# download the most recent version of minecraft
|
||||||
docker-compose up minecraft
|
make get-server
|
||||||
|
|
||||||
|
# Run the server
|
||||||
|
docker-compose up
|
||||||
```
|
```
|
||||||
|
|
||||||
## Uploading to Docker Hub
|
## 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
|
```bash
|
||||||
docker-compose push
|
make build
|
||||||
|
make push
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running in kubernetes
|
## Running in kubernetes
|
||||||
|
|
||||||
In k8s/deploy.yaml, edit the deploy
|
Requires helm v3. Edit values.yaml and run the following:
|
||||||
|
|
||||||
```yaml
|
|
||||||
...
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: minecraft
|
|
||||||
image: <your image from above>
|
|
||||||
ports:
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
Then run the following
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
kubectl apply -f k8s/pvc
|
helm upgrade --install minecraft
|
||||||
kubectl apply -f k8s
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Your minecraft server will be available on port 25565
|
Your minecraft server will be available on port 25565 by default.
|
||||||
|
|
||||||
## Create a Backup
|
## Create a Backup
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,6 @@ spec:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- mountPath: /downloads
|
- mountPath: /downloads
|
||||||
name: data
|
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:
|
containers:
|
||||||
- name: {{ .Release.Name }}
|
- name: {{ .Release.Name }}
|
||||||
image: {{ .Values.image }}
|
image: {{ .Values.image }}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
image: ducoterra/minecraft:latest
|
image: ducoterra/minecraft:latest
|
||||||
get_server:
|
get_server:
|
||||||
image: ducoterra/get-minecraft:latest
|
image: ducoterra/get-minecraft:2.0.0
|
||||||
server_version: "1.17.1"
|
server_version: "1.17.1"
|
||||||
port: 20101
|
port: 20101
|
||||||
max_cpu: 4
|
max_cpu: 4
|
||||||
|
|||||||
Reference in New Issue
Block a user