From 6eef1d760de266f049812165311949beb1d184b8 Mon Sep 17 00:00:00 2001 From: oscarpocock Date: Sat, 20 Aug 2022 18:49:37 +0100 Subject: [PATCH] Initial commit --- Dockerfile | 23 +++++++++++++++++++++++ README.md | 4 ++++ docker-compose.yml | 20 ++++++++++++++++++++ run.py | 40 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 87 insertions(+) create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 docker-compose.yml create mode 100644 run.py diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..03479ad --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +FROM python:3.10.4 + +# set version label +ARG PLUGET_VERSION=v1.7.2 +LABEL maintainer="oscar@oscarpo.co" +ENV HOME="/config" + +RUN curl -LO https://github.com/Neocky/pluGET/releases/download/$PLUGET_VERSION/pluGET-$PLUGET_VERSION.zip + +RUN unzip -d config pluGET-$PLUGET_VERSION.zip + +COPY /run.py $HOME + +WORKDIR $HOME + +RUN pip install -r requirements.txt + +# allow non-interactive creation of config file +RUN sed -i '/input("Press any key + enter to exit...")/d' $HOME/src/handlers/handle_config.py + +RUN python3 pluget.py + +CMD python3 run.py && python3 pluget.py \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..c6bf58e --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +# pluGET +A powerful package manager which updates [Plugins](https://www.spigotmc.org/resources/) and Server Software for minecraft servers. + +For the original project license check: https://github.com/Neocky/pluGET \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..acbc628 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,20 @@ +version: "3" +services: + pluget: + build: + context: . + dockerfile: Dockerfile + image: noble/pluget + environment: + - CONNECTION=local + - LOCAL_PLUGIN_FOLDER=C:/Users/USER/Desktop/plugins + - LOCAL_ENABLE_SEPERATE_DOWNLOAD_PATH=false + - LOCAL_SEPERATE_DOWNLOAD_PATH=C:/Users/USER/Desktop/plugins + - REMOTE_SERVER=0.0.0.0 + - REMOTE_USERNAME=user + - REMOTE_PASSWORD=password + - REMOTE_SFTP_PORT=22 + - REMOTE_FTP_PORT=21 + - REMOTE_PLUGIN_FOLDER=/plugins + - REMOTE_ENABLE_SEPERATE_DOWNLOAD_PATH=false + - REMOTE_SEPERATE_DOWNLOAD_PATH=/plugins/updated \ No newline at end of file diff --git a/run.py b/run.py new file mode 100644 index 0000000..a916818 --- /dev/null +++ b/run.py @@ -0,0 +1,40 @@ +import os +import sys +import ruamel.yaml + +yaml = ruamel.yaml.YAML() +with open("pluGET_config.yaml", "r") as config_file: + data = yaml.load(config_file) + +# Connection (local, sftp, ftp) +if "CONNECTION" in os.environ: + data['Connection'] = os.environ["CONNECTION"] + +# LOCAL +if "LOCAL_PLUGIN_FOLDER" in os.environ: + data['Local']['PathToPluginFolder'] = os.environ["LOCAL_PLUGIN_FOLDER"] +if "LOCAL_ENABLE_SEPERATE_DOWNLOAD_PATH" in os.environ: + data['Local']['SeperateDownloadPath'] = os.environ[""] +if "LOCAL_SEPERATE_DOWNLOAD_PATH" in os.environ: + data['Local']['PathToSeperateDownloadPath'] = os.environ["LOCAL_SEPERATE_DOWNLOAD_PATH"] + +# REMOTE +if "REMOTE_SERVER" in os.environ: + data['Remote']['Server'] = os.environ["REMOTE_SERVER"] +if "REMOTE_USERNAME" in os.environ: + data['Remote']['Username'] = os.environ["REMOTE_USERNAME"] +if "REMOTE_PASSWORD" in os.environ: + data['Remote']['Password'] = os.environ["REMOTE_PASSWORD"] +if "REMOTE_SFTP_PORT" in os.environ: + data['Remote']['SFTP_Port'] = os.environ["REMOTE_SFTP_PORT"] +if "REMOTE_FTP_PORT" in os.environ: + data['Remote']['FTP_Port'] = os.environ["REMOTE_FTP_PORT"] +if "REMOTE_PLUGIN_FOLDER" in os.environ: + data['Remote']['PluginFolderOnServer'] = os.environ["REMOTE_PLUGIN_FOLDER"] +if "REMOTE_ENABLE_SEPERATE_DOWNLOAD_PATH" in os.environ: + data['Remote']['SeperateDownloadPath'] = os.environ["REMOTE_ENABLE_SEPERATE_DOWNLOAD_PATH"] +if "REMOTE_SEPERATE_DOWNLOAD_PATH" in os.environ: + data['Remote']['PathToSeperateDownloadPath'] = os.environ["REMOTE_SEPERATE_DOWNLOAD_PATH"] + +with open("pluGET_config.yaml", "w") as config_file: + yaml.dump(data, config_file) \ No newline at end of file