feature-42 docker #1
1
.dockerignore
Normal file
1
.dockerignore
Normal file
@ -0,0 +1 @@
|
||||
*/logs
|
46
.github/workflows/build-docker.yml
vendored
Normal file
46
.github/workflows/build-docker.yml
vendored
Normal file
@ -0,0 +1,46 @@
|
||||
---
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
jobs:
|
||||
build-docker:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
registry: gitea.cuqmbr.xyz
|
||||
steps:
|
||||
- name: Login to Docker Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{env.registry}}
|
||||
username: ${{vars.DOCKER_USER}}
|
||||
password: ${{secrets.DOCKER_TOKEN}}
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
# https://github.com/actions/checkout/issues/1830
|
||||
# https://gitea.com/gitea/act_runner/issues/164
|
||||
- name: Checkout lfs
|
||||
run: |
|
||||
git lfs install --local
|
||||
AUTH=$(git config --local http.${{ github.server_url }}/.extraheader)
|
||||
git config --local --unset http.${{ github.server_url }}/.extraheader
|
||||
git config --local http.${{ github.server_url }}/${{ github.repository }}.git/info/lfs/objects/batch.extraheader "$AUTH"
|
||||
git lfs pull
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./Dockerfile
|
||||
platforms: linux/arm64,linux/amd64
|
||||
push: true
|
||||
# TODO: split tag names into multiple lines
|
||||
tags: |
|
||||
${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:${{github.sha}}
|
||||
${{env.registry}}/${{github.repository_owner}}/${{github.event.repository.name}}/${{github.ref_name}}:latest
|
17
.gitignore
vendored
17
.gitignore
vendored
@ -1,16 +1 @@
|
||||
cache
|
||||
libraries
|
||||
logs
|
||||
versions
|
||||
|
||||
world
|
||||
world_nether
|
||||
world_the_end
|
||||
|
||||
./.console_history
|
||||
|
||||
banned-ips.json
|
||||
banned-players.json
|
||||
ops.json
|
||||
whitelist.json
|
||||
usercache.json
|
||||
*/logs
|
||||
|
33
Dockerfile
Normal file
33
Dockerfile
Normal file
@ -0,0 +1,33 @@
|
||||
FROM sapmachine:21-jre-headless-ubuntu
|
||||
|
||||
|
||||
ENV WORKDIR_PATH=/workspace
|
||||
ENV CONFIG_PATH=${WORKDIR_PATH}/config
|
||||
ENV DATA_PATH=${WORKDIR_PATH}/data
|
||||
|
||||
ADD ./src ${CONFIG_PATH}
|
||||
RUN mkdir ${DATA_PATH}
|
||||
|
||||
|
||||
RUN mkdir ${DATA_PATH}/logs && \
|
||||
ln -sf ${DATA_PATH}/logs ${CONFIG_PATH}
|
||||
|
||||
VOLUME ${DATA_PATH}
|
||||
|
||||
|
||||
ENV MEMORY=4G
|
||||
ENV PROXY_SECRET=change_me
|
||||
ENV SERVERS=lobby="lobby:25565";survival="survival:25565"
|
||||
ENV TRY=lobby;survival
|
||||
|
||||
WORKDIR ${WORKDIR_PATH}/config
|
||||
|
||||
EXPOSE 25565/tcp
|
||||
|
||||
# TODO: Make awk commands sapn multiple lines
|
||||
# TODO: Use one call to awk to perform substitutions
|
||||
CMD \
|
||||
sed -i "s/_PROXY_SECRET_/${PROXY_SECRET}/g" forwarding.secret && \
|
||||
awk -v servers_str="${SERVERS}" '{ count=split(servers_str,servers_arr,";"); servers_fmt_str = ""; for (i = 1; i <= count; i++) servers_fmt_str = servers_fmt_str servers_arr[i] "\n"; sub(/_SERVERS_/,servers_fmt_str); print }' velocity.toml > velocity.toml.tmp && mv -T -f velocity.toml.tmp velocity.toml &&\
|
||||
awk -v try_str="${TRY}" '{ count=split(try_str,try_arr,";"); try_fmt_str = ""; for (i = 1; i <= count; i++) try_fmt_str = try_fmt_str "\"" try_arr[i] "\"" ",\n "; sub(/_TRY_/,try_fmt_str); print }' velocity.toml > velocity.toml.tmp && mv -T -f velocity.toml.tmp velocity.toml && \
|
||||
java -Xms${MEMORY} -Xmx${MEMORY} -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar *.jar
|
@ -1 +0,0 @@
|
||||
gWlMDmsD2kAI
|
1
src/forwarding.secret
Normal file
1
src/forwarding.secret
Normal file
@ -0,0 +1 @@
|
||||
_PROXY_SECRET_
|
@ -1,3 +1,3 @@
|
||||
@echo off
|
||||
java -Xms1G -Xmx1G -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar velocity.jar
|
||||
java -Xms1G -Xmx1G -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar *.jar
|
||||
pause
|
@ -1,3 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
java -Xms1G -Xmx1G -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar velocity*.jar
|
||||
java -Xms1G -Xmx1G -XX:+UseG1GC -XX:G1HeapRegionSize=4M -XX:+UnlockExperimentalVMOptions -XX:+ParallelRefProcEnabled -XX:+AlwaysPreTouch -XX:MaxInlineLevel=15 -jar *.jar
|
@ -13,7 +13,7 @@ motd = "<#09add3>A Velocity Server"
|
||||
show-max-players = 500
|
||||
|
||||
# Should we authenticate players with Mojang? By default, this is on.
|
||||
online-mode = true
|
||||
online-mode = false
|
||||
|
||||
# Should the proxy enforce the new public key security standard? By default, this is on.
|
||||
force-key-authentication = true
|
||||
@ -34,7 +34,7 @@ prevent-client-proxy-connections = false
|
||||
# unable to implement network level firewalling (on a shared host).
|
||||
# - "modern": Forward player IPs and UUIDs as part of the login process using
|
||||
# Velocity's native forwarding. Only applicable for Minecraft 1.13 or higher.
|
||||
player-info-forwarding-mode = "NONE"
|
||||
player-info-forwarding-mode = "modern"
|
||||
|
||||
# If you are using modern or BungeeGuard IP forwarding, configure a file that contains a unique secret here.
|
||||
# The file is expected to be UTF-8 encoded and not empty.
|
||||
@ -77,26 +77,24 @@ enable-player-address-logging = true
|
||||
[servers]
|
||||
# Configure your servers here. Each key represents the server's name, and the value
|
||||
# represents the IP address of the server to connect to.
|
||||
lobby = "127.0.0.1:30066"
|
||||
factions = "127.0.0.1:30067"
|
||||
minigames = "127.0.0.1:30068"
|
||||
_SERVERS_
|
||||
|
||||
# In what order we should try servers when a player logs in or is kicked from a server.
|
||||
try = [
|
||||
"lobby"
|
||||
_TRY_
|
||||
]
|
||||
|
||||
[forced-hosts]
|
||||
# Configure your forced hosts here.
|
||||
"lobby.example.com" = [
|
||||
"lobby"
|
||||
]
|
||||
"factions.example.com" = [
|
||||
"factions"
|
||||
]
|
||||
"minigames.example.com" = [
|
||||
"minigames"
|
||||
]
|
||||
# "lobby.example.com" = [
|
||||
# "lobby"
|
||||
# ]
|
||||
# "factions.example.com" = [
|
||||
# "factions"
|
||||
# ]
|
||||
# "minigames.example.com" = [
|
||||
# "minigames"
|
||||
# ]
|
||||
|
||||
[advanced]
|
||||
# How large a Minecraft packet has to be before we compress it. Setting this to zero will
|
Loading…
Reference in New Issue
Block a user