├── .gitignore ├── bin └── start.sh ├── velocity ├── alpine │ └── Dockerfile ├── debian │ └── Dockerfile └── build.sh ├── LICENSE ├── .github └── workflows │ └── velocity.yml └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .idea -------------------------------------------------------------------------------- /bin/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | umask 0002 4 | chmod g+w /data 5 | 6 | # Copy content from /run/data/ to /data/. 7 | # This is useful for mounting read-only filesystem such as ConfigMaps in Kubernetes. 8 | if [ -d /run/data ]; then 9 | cp -rf /run/data/ / 10 | fi 11 | 12 | # Environment variables 13 | INIT_MEMORY=${INIT_MEMORY:=${MEMORY}} 14 | MAX_MEMORY=${MAX_MEMORY:=${MEMORY}} 15 | 16 | JVM_XX_OPTS=${JVM_XX_OPTS:-"-XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15"} 17 | JVM_OPTS="-Xms$INIT_MEMORY -Xmx$MAX_MEMORY ${JVM_OPTS}" 18 | D_OPTS="${D_OPTS}" 19 | 20 | # Start the server 21 | # shellcheck disable=SC2086 disable=SC2068 22 | exec java $JVM_XX_OPTS $JVM_OPTS $D_OPTS -jar /server.jar $@ 23 | -------------------------------------------------------------------------------- /velocity/alpine/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG RUNTIME 2 | ARG RUNTIME_NAME 3 | 4 | FROM $RUNTIME 5 | 6 | LABEL org.opencontainers.image.documentation="https://github.com/Cubxity/docker-minecraft-proxy" 7 | LABEL org.opencontainers.image.authors="Cubxity " 8 | LABEL org.opencontainers.image.source="https://github.com/Cubxity/docker-minecraft-proxy" 9 | LABEL org.opencontainers.image.version="velocity-$VELOCITY_VERSION-$RUNTIME_NAME" 10 | 11 | ARG VELOCITY_VERSION 12 | ARG VELOCITY_BUILD 13 | ARG VELOCITY_SHA256 14 | 15 | RUN addgroup -g 1000 minecraft \ 16 | && adduser -Ss /bin/false -u 1000 -G minecraft -h /home/minecraft minecraft \ 17 | && mkdir -m 775 /data \ 18 | && chown minecraft:minecraft /data \ 19 | && wget -O /server.jar "https://papermc.io/api/v2/projects/velocity/versions/$VELOCITY_VERSION/builds/$VELOCITY_BUILD/downloads/velocity-$VELOCITY_VERSION-$VELOCITY_BUILD.jar" \ 20 | && echo "$VELOCITY_SHA256 /server.jar" | sha256sum -c - 21 | 22 | COPY bin/start.sh /start.sh 23 | 24 | ENV MEMORY="1G" 25 | 26 | WORKDIR /data 27 | ENTRYPOINT [ "/start.sh" ] 28 | 29 | USER minecraft 30 | EXPOSE 25577 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2021 Cubxity 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /velocity/debian/Dockerfile: -------------------------------------------------------------------------------- 1 | ARG RUNTIME 2 | ARG RUNTIME_NAME 3 | 4 | FROM $RUNTIME 5 | 6 | LABEL org.opencontainers.image.documentation="https://github.com/Cubxity/docker-minecraft-proxy" 7 | LABEL org.opencontainers.image.authors="Cubxity " 8 | LABEL org.opencontainers.image.source="https://github.com/Cubxity/docker-minecraft-proxy" 9 | LABEL org.opencontainers.image.version="velocity-$VELOCITY_VERSION-$RUNTIME_NAME" 10 | 11 | ARG VELOCITY_VERSION 12 | ARG VELOCITY_BUILD 13 | ARG VELOCITY_SHA256 14 | 15 | RUN groupadd -g 1000 minecraft \ 16 | && useradd -r -s /bin/false -u 1000 -g 1000 -m minecraft \ 17 | && mkdir -m 775 /data \ 18 | && chown minecraft:minecraft /data \ 19 | && apt-get update && apt-get install -y curl \ 20 | && curl -sfL -o /server.jar "https://papermc.io/api/v2/projects/velocity/versions/$VELOCITY_VERSION/builds/$VELOCITY_BUILD/downloads/velocity-$VELOCITY_VERSION-$VELOCITY_BUILD.jar" \ 21 | && echo "$VELOCITY_SHA256 /server.jar" | sha256sum -c - 22 | 23 | COPY bin/start.sh /start.sh 24 | 25 | ENV MEMORY="1G" 26 | 27 | WORKDIR /data 28 | ENTRYPOINT [ "/start.sh" ] 29 | 30 | USER minecraft 31 | EXPOSE 25577 32 | -------------------------------------------------------------------------------- /velocity/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | version=$(curl -s "https://nexus.velocitypowered.com/repository/maven-public/com/velocitypowered/velocity-native/maven-metadata.xml" | sed -n 's/.*\([^<]*\)<\/release>/\1/p') 3 | 4 | curl -s https://papermc.io/api/v2/projects/velocity/ | jq -r -c ".versions[]" | while read -r version; do 5 | build=$(curl -s "https://papermc.io/api/v2/projects/velocity/versions/$version" | jq -r ".builds[-1]") 6 | hash=$(curl -s "https://papermc.io/api/v2/projects/velocity/versions/$version/builds/$build" | jq -r ".downloads.application.sha256") 7 | 8 | echo "[velocity] building velocity-$version-$build-$RUNTIME_NAME" 9 | 10 | docker buildx build \ 11 | --build-arg "RUNTIME=$RUNTIME_IMAGE" \ 12 | --build-arg "RUNTIME_NAME=$RUNTIME_NAME" \ 13 | --build-arg "VELOCITY_VERSION=$version" \ 14 | --build-arg "VELOCITY_BUILD=$build" \ 15 | --build-arg "VELOCITY_SHA256=$hash" \ 16 | --tag "$REPOSITORY:velocity-$version-$RUNTIME_NAME" \ 17 | --tag "$REPOSITORY:velocity-$RUNTIME_NAME" \ 18 | --cache-from "type=registry,ref=$REPOSITORY:velocity-$version-$RUNTIME_NAME" \ 19 | --cache-to "type=registry,ref=$REPOSITORY:velocity-$version-$RUNTIME_NAME,mode=max" \ 20 | --file "velocity/$RUNTIME_OS/Dockerfile" \ 21 | --platform "$RUNTIME_PLATFORM" \ 22 | --push \ 23 | . || exit 1 24 | done 25 | -------------------------------------------------------------------------------- /.github/workflows/velocity.yml: -------------------------------------------------------------------------------- 1 | name: Build Velocity 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | paths: 7 | - velocity/** 8 | - bin/** 9 | - .github/workflows/velocity.yml 10 | schedule: 11 | - cron: "0 */12 * * *" 12 | 13 | jobs: 14 | build: 15 | name: velocity-${{ matrix.runtime.name }} 16 | runs-on: ubuntu-latest 17 | strategy: 18 | matrix: 19 | runtime: 20 | - image: eclipse-temurin:17-jre-jammy 21 | name: temurin17-jammy 22 | version: 17 23 | platform: linux/amd64,linux/arm64/v8 24 | os: debian 25 | - image: eclipse-temurin:11-jre-jammy 26 | name: temurin11-jammy 27 | version: 11 28 | platform: linux/amd64,linux/arm64/v8 29 | os: debian 30 | - image: eclipse-temurin:17-alpine 31 | name: temurin17-alpine 32 | version: 17 33 | platform: linux/amd64 34 | os: alpine 35 | 36 | fail-fast: false 37 | 38 | steps: 39 | - uses: actions/checkout@v3 40 | 41 | - name: Set up QEMU 42 | uses: docker/setup-qemu-action@v2 43 | 44 | - name: Set up Docker Buildx 45 | uses: docker/setup-buildx-action@v2 46 | with: 47 | driver-opts: image=moby/buildkit:master 48 | 49 | - name: Log in to ghcr.io 50 | uses: docker/login-action@v2 51 | with: 52 | registry: ghcr.io 53 | username: ${{ github.repository_owner }} 54 | password: ${{ secrets.GITHUB_TOKEN }} 55 | 56 | - name: Set variables 57 | id: vars 58 | run: | 59 | REPOSITORY_OWNER=${GITHUB_REPOSITORY,,} 60 | echo "repository_owner=${REPOSITORY_OWNER%%/*}" >> "$GITHUB_OUTPUT" 61 | 62 | - name: Build and push 63 | run: ./velocity/build.sh 64 | env: 65 | RUNTIME_IMAGE: ${{ matrix.runtime.image }} 66 | RUNTIME_NAME: ${{ matrix.runtime.name }} 67 | RUNTIME_VERSION: ${{ matrix.runtime.version }} 68 | RUNTIME_PLATFORM: ${{ matrix.runtime.platform }} 69 | RUNTIME_OS: ${{ matrix.runtime.os }} 70 | REPOSITORY: ghcr.io/${{ steps.vars.outputs.repository_owner }}/minecraft-proxy 71 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![License](https://img.shields.io/github/license/Cubxity/docker-minecraft-proxy?style=flat-square)](LICENSE) 2 | [![Issues](https://img.shields.io/github/issues/Cubxity/docker-minecraft-proxy?style=flat-square)](https://github.com/Cubxity/docker-minecraft-proxy/issues) 3 | [![Discord](https://img.shields.io/badge/join-discord-blue?style=flat-square)](https://discord.gg/kDDhqJmPpA) 4 | 5 | # docker-minecraft-proxy 6 | 7 | Lightweight Docker/container images for Minecraft proxies. 8 | 9 | ## Running 10 | 11 | > **WARNING:** The following container is **ephemeral**, meaning any changes made to it will be discarded. 12 | 13 | ```shell 14 | $ docker run --rm -it -p 25565:25577 ghcr.io/cubxity/minecraft-proxy:velocity-temurin17-jammy 15 | ``` 16 | 17 | - `--rm` removes the container on exit 18 | - `-i` keeps STDIN open 19 | - `-t` allocates a pseudo-TTY 20 | - `-p` publish port(s) to the host 21 | 22 | This image makes use of Velocity's recommended flags by default. The data directory is located at `/data`. 23 | 24 | ## Environment variables 25 | 26 | - `MEMORY` defaults to `1G` 27 | - `INIT_MEMORY` Initial memory to allocate to the JVM. Defaults to `MEMORY` 28 | - `MAX_MEMORY` Maximum memory to allocate to the JVM. Defaults to `MEMORY` 29 | - `JVM_XX_OPTS` -XX JVM argument overrides 30 | - `JVM_OPTS` JVM arguments to append 31 | 32 | ## Variants 33 | 34 | This repository provides OpenJDK and Eclipse Temurin based container images for **Velocity**. 35 | 36 | > ⚠️ AdoptOpenJDK (`adopt*`) and OpenJDK (`java*`) variants are **deprecated** in favor of Eclipse Temurin. 37 | > Support for non-LTS versions may be dropped at any time. 38 | 39 | ### Eclipse Temurin Alpine (`temurin*-alpine`) 40 | 41 | Supports `linux/amd64`. 42 | 43 | This image is based on Eclipse Temurin's Alpine image. The image format is suffixed with `-temurin-alpine`. 44 | 45 | **Examples:** 46 | 47 | - `velocity-temurin17-alpine` 48 | - `velocity-3.2.0-SNAPSHOT-temurin17-alpine` 49 | 50 | ### Eclipse Temurin Ubuntu Jammy (`temurin*-jammy`) 51 | 52 | Supports `linux/amd64` and `linux/arm64`. 53 | 54 | This image is based on Eclipse Temurin's Ubuntu Jammy Jellyfish image. The image format is suffixed 55 | with `-temurin-jammy`. 56 | 57 | **Examples:** 58 | 59 | - `velocity-temurin17-jammy` 60 | - `velocity-3.2.0-SNAPSHOT-temurin17-jammy` 61 | --------------------------------------------------------------------------------