Update Platforms #390

Merged
Sirherobrine23 merged 10 commits from StashCode into main 2022-06-09 20:22:38 +00:00
4 changed files with 78 additions and 72 deletions
Showing only changes of commit f090b3475d - Show all commits

View File

@ -1,12 +1,18 @@
FROM debian:latest
ENV DEBIAN_FRONTEND="noninteractive"
RUN \
apt update && \
apt install -y git curl wget sudo procps zsh tar screen ca-certificates procps lsb-release xdg-utils g++ libatomic1 libnss3 libatk-bridge2.0-0 gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxrandr2 libxrender1 libxss1 libxtst6 fonts-liberation libnss3 libgbm-dev
ARG DEBIAN_FRONTEND="noninteractive"
RUN apt update && apt install -y git curl wget sudo procps zsh tar screen ca-certificates procps lsb-release xdg-utils g++ gconf-service gpg
# Install node.js
RUN wget $(wget -qO- https://api.github.com/repos/Sirherobrine23/DebianNodejsFiles/releases | grep 'browser_download_url' | grep "$(dpkg --print-architecture)" | cut -d '"' -f 4 | sort | uniq | tail -n 1) -q -O /tmp/nodejs.deb && dpkg -i /tmp/nodejs.deb && rm -rfv /tmp/nodejs.deb && npm install -g npm@latest
# Install Docker and Docker Compose
VOLUME [ "/var/lib/docker" ]
RUN wget -qO- https://get.docker.com | sh && \
wget -q $(wget -qO- https://api.github.com/repos/docker/compose/releases | grep 'browser_download_url' | grep -v '.sha' | grep $(uname -s) | grep $(uname -m) | cut -d '"' -f 4 | sort | tail -n1)\
-O /usr/local/bin/docker-compose && chmod +x -v /usr/local/bin/docker-compose
# Install openjdk
RUN \
apt update && \
RUN apt update && \
JAVAVERSIONS="$(apt search openjdk|grep '/'|grep 'openjdk-'|sed 's|/| |g'|awk '{print $1}'|grep 'jre'|sed -e 's|-jre.*||g'|uniq)";\
case $JAVAVERSIONS in \
*17* ) apt install -y openjdk-17*;; \
@ -14,61 +20,55 @@ RUN \
*) echo "Unsupported Java Version, avaibles"; echo "$JAVAVERSIONS";exit 0;; \
esac
# Install latest node
RUN VERSION=$(wget -qO- https://api.github.com/repos/Sirherobrine23/DebianNodejsFiles/releases/latest |grep 'name' | grep "nodejs"|grep "$(dpkg --print-architecture)"|cut -d '"' -f 4 | sed 's|nodejs_||g' | sed -e 's|_.*.deb||g'|sort | uniq|tail -n 1); wget -q "https://github.com/Sirherobrine23/DebianNodejsFiles/releases/download/debs/nodejs_${VERSION}_$(dpkg --print-architecture).deb" -O /tmp/nodejs.deb && dpkg -i /tmp/nodejs.deb && rm -rfv /tmp/nodejs.deb && npm install -g npm@latest
# Install Docker and Docker Compose
RUN curl https://get.docker.com | sh && \
compose_version="$(curl -s https://api.github.com/repos/docker/compose/releases/latest | grep tag_name | cut -d \" -f 4)"; \
wget -q https://github.com/docker/compose/releases/download/${compose_version}/docker-compose-`uname -s`-`uname -m` -O /usr/local/bin/docker-compose && \
chmod +x -v /usr/local/bin/docker-compose
VOLUME [ "/var/lib/docker" ]
# Create docker and minikube start script
ARG DOCKERD_ARGS="--experimental"
RUN (echo '#''!/bin/bash';\
echo 'EXISTDOCKER="1"';\
echo "if command -v dockerd &> /dev/null; then";\
echo ' if ! [[ -f "/var/run/docker.sock" ]];then';\
echo " (sudo dockerd ${DOCKERD_ARGS}) &";\
echo " sleep 5s";\
echo " fi";\
echo "else";\
echo ' EXISTDOCKER="0"';\
echo "fi";\
echo "";\
echo "# Run script";\
echo 'if ! [[ -z "\$@" ]]; then';\
echo ' sh -c "\$@"';\
echo "fi";\
echo "";\
echo "# Check docker is running";\
echo 'if [[ "\${EXISTDOCKER}" == "0" ]];then';\
echo " while true; do";\
echo " if ! (docker info &> /dev/null) || ps -ef | grep -v grep | grep -q dockerd; then";\
echo ' echo "Dockerd stopped"';\
echo " break";\
echo " fi";\
echo " sleep 4s";\
echo " done";\
echo "fi";\
echo "";\
echo "# Sleep script";\
echo "sleep infinity";\
echo "exit") | tee /usr/local/bin/start.sh && chmod a+x /usr/local/bin/start.sh
# Add non root user
ARG USERNAME=gitpod
ARG USER_UID=1000
ARG USERNAME="devcontainer"
ARG USER_UID="1000"
ARG USER_GID=$USER_UID
RUN \
groupadd --gid $USER_GID $USERNAME && \
RUN groupadd --gid $USER_GID $USERNAME && \
adduser --disabled-password --gecos "" --shell /usr/bin/zsh --uid $USER_UID --gid $USER_GID $USERNAME && \
usermod -aG sudo $USERNAME && echo "$USERNAME ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/$USERNAME && \
chmod 0440 /etc/sudoers.d/$USERNAME && \
usermod -aG docker $USERNAME
chmod 0440 /etc/sudoers.d/$USERNAME && usermod -aG docker $USERNAME
USER $USERNAME
WORKDIR /home/$USERNAME
CMD [ "/usr/bin/zsh" ]
# Set default entrypoint
ENTRYPOINT [ "/usr/local/bin/start.sh" ]
# Install oh my zsh
RUN yes | sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" && \
git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ~/.oh-my-zsh/custom/plugins/zsh-syntax-highlighting && \
git clone https://github.com/zsh-users/zsh-autosuggestions ~/.oh-my-zsh/custom/plugins/zsh-autosuggestions && \
sed -e 's|ZSH_THEME=".*"|ZSH_THEME="strug"|g' -i ~/.zshrc && \
sed -e 's|plugins=(.*)|plugins=(git docker zsh-syntax-highlighting zsh-autosuggestions)|g' -i ~/.zshrc
# Create Start Script
ENV DOCKERD_ARGS=""
RUN (\
echo '#''!/bin/bash';\
echo "set -e";\
echo 'if ! [[ -f "/var/run/docker.sock" ]];then';\
echo " (sudo dockerd ${DOCKERD_ARGS}) &";\
echo "fi";\
echo 'if ! [[ -z "$@" ]]; then';\
echo ' sh -c "$@"';\
echo "fi";\
echo "";\
echo "while true; do";\
echo " if ps -ef | grep -v grep | grep -q dockerd; then";\
echo ' echo "Docker daemon is running"';\
echo " elif docker info &> /dev/null; then";\
echo ' echo "Docker daemon is running"';\
echo " else";\
echo " break";\
echo " fi";\
echo " sleep 4s";\
echo "done";\
echo "";\
echo "echo Dockerd stopped";\
echo "exit 2")|sudo tee /usr/local/bin/start.sh && sudo chmod +x /usr/local/bin/start.sh
ENTRYPOINT [ "/usr/local/bin/start.sh" ]
sed -e 's|ZSH_THEME=".*"|ZSH_THEME="strug"|g' -i ~/.zshrc && sed -e 's|plugins=(.*)|plugins=(git docker zsh-syntax-highlighting zsh-autosuggestions)|g' -i ~/.zshrc

14
.github/FUNDING.yml vendored
View File

@ -1,14 +1,2 @@
# These are supported funding model platforms
github:
- Sirherobrine23
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
- Sirherobrine23

View File

@ -2,4 +2,22 @@ import * as bedrock from "./bedrock/index";
import * as pocketmine from "./pocketmine/index";
import * as java from "./java/index";
import * as spigot from "./spigot/index";
export {bedrock, pocketmine, java, spigot}
type globalPlatform = {
[platform: string]: {
DownloadServer: (version: string) => Promise<{version: string, publishDate: Date, url: string}>,
backup: {
CreateBackup: () => Promise<Buffer>,
}
}
};
bedrock.backup.CreateBackup
const platforms: globalPlatform = {
bedrock,
pocketmine,
java,
spigot
}
export default platforms