diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 616af73..0000000 --- a/.editorconfig +++ /dev/null @@ -1,12 +0,0 @@ -root = true - -[*] -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true -indent_style = space -indent_size = 4 - -[*.yml] -indent_size = 2 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d850f12..2f4691d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,13 +1,18 @@ variables: - IMAGE_NAME: thallian/minecraft + CONTAINER_NAME: thallian/minecraft build: stage: build + image: + name: gcr.io/kaniko-project/executor:debug + entrypoint: [""] script: - - docker login -u $DOCKER_USER -p $DOCKER_PASSWORD $DOCKER_REGISTRY - - docker build -t $IMAGE_NAME:$CI_COMMIT_SHA . - - docker build -t $IMAGE_NAME:$CI_COMMIT_REF_NAME . - - docker build -t $IMAGE_NAME:latest . - - docker push $IMAGE_NAME:$CI_COMMIT_SHA - - docker push $IMAGE_NAME:$CI_COMMIT_REF_NAME - - docker push $IMAGE_NAME:latest + - mkdir -p /kaniko/.docker + - echo "{\"auths\":{\"$CI_REGISTRY\":{\"auth\":\"$(printf "%s:%s" "$CI_REGISTRY_USER" "$CI_REGISTRY_PASSWORD" | base64 | tr -d '\n')\"}}}" > /kaniko/.docker/config.json + - >- + /kaniko/executor + --context "$CI_PROJECT_DIR" + --dockerfile "$CI_PROJECT_DIR/Dockerfile" + --destination "$CONTAINER_NAME:$CI_COMMIT_SHA" + --destination "$CONTAINER_NAME:$CI_COMMIT_REF_NAME" + --destination "$CONTAINER_NAME:latest" diff --git a/Dockerfile b/Dockerfile index 61ee8ec..9168695 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,24 +3,28 @@ FROM thallian/confd-env:latest RUN addgroup minecraft -g 2222 RUN adduser -u 2222 -h /var/lib/minecraft -D -G minecraft minecraft -ENV VERSION=1.17.1 -ENV SERIAL=400 -ENV SHA256_SUM=3b8ea78e28f5f5224ef692762e36150e16c352e9159f6cb00db466a0de787f38 +ENV VERSION=1.18.1 +ENV SERIAL=198 +ENV SHA256_SUM=8074cb747c215777c0d16bae4abbe98acda6b9a1f6a223dd128a44175ed33075 RUN wget -O /var/lib/minecraft/paper.jar \ https://papermc.io/api/v2/projects/paper/versions/$VERSION/builds/$SERIAL/downloads/paper-$VERSION-$SERIAL.jar RUN echo "$SHA256_SUM /var/lib/minecraft/paper.jar" | sha256sum -c - || exit 1 RUN apk add --no-cache \ - openssl - -RUN apk add --no-cache --repository=http://dl-cdn.alpinelinux.org/alpine/edge/community \ - openjdk17-jre-headless - -RUN mkdir -p /etc/services.d/minecraft/ + openssl \ + openjdk17-jre-headless ADD /rootfs / +RUN mkdir /var/lib/minecraft/settings +WORKDIR /var/lib/minecraft + +RUN ln -s ops.json settings/ops.json +RUN ln -s whitelist.json settings/whitelist.json +RUN ln -s banned-ips.json settings/banned-ips.json +RUN ln -s banned-players.json settings/banned-players.json + RUN chown -R minecraft:minecraft /var/lib/minecraft VOLUME /var/lib/minecraft/world /var/lib/minecraft/world_nether /var/lib/minecraft/world_the_end /var/lib/minecraft/plugins diff --git a/rootfs/etc/s6-overlay/s6-rc.d/minecraft/dependencies b/rootfs/etc/s6-overlay/s6-rc.d/minecraft/dependencies new file mode 100644 index 0000000..7ba7514 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/minecraft/dependencies @@ -0,0 +1 @@ +confd diff --git a/rootfs/etc/s6-overlay/s6-rc.d/minecraft/run b/rootfs/etc/s6-overlay/s6-rc.d/minecraft/run new file mode 100755 index 0000000..2230d52 --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/minecraft/run @@ -0,0 +1,4 @@ +#!/bin/sh + +cd /var/lib/minecraft +exec s6-setuidgid minecraft java -Xms${MIN_RAM:-512M} -Xmx${MAX_RAM:-512M} -XX:+UseG1GC -jar /var/lib/minecraft/paper.jar diff --git a/rootfs/etc/s6-overlay/s6-rc.d/minecraft/type b/rootfs/etc/s6-overlay/s6-rc.d/minecraft/type new file mode 100644 index 0000000..5883cff --- /dev/null +++ b/rootfs/etc/s6-overlay/s6-rc.d/minecraft/type @@ -0,0 +1 @@ +longrun diff --git a/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/minecraft b/rootfs/etc/s6-overlay/s6-rc.d/user/contents.d/minecraft new file mode 100644 index 0000000..e69de29 diff --git a/rootfs/etc/services.d/minecraft/run b/rootfs/etc/services.d/minecraft/run index f1e2bca..2230d52 100755 --- a/rootfs/etc/services.d/minecraft/run +++ b/rootfs/etc/services.d/minecraft/run @@ -1,4 +1,4 @@ -#!/usr/bin/with-contenv sh +#!/bin/sh cd /var/lib/minecraft exec s6-setuidgid minecraft java -Xms${MIN_RAM:-512M} -Xmx${MAX_RAM:-512M} -XX:+UseG1GC -jar /var/lib/minecraft/paper.jar