commit bcdfd8055aebe22f10d3b92a3da10c6067f0c77e Author: Astra Date: Sun Apr 23 22:06:29 2023 +0000 Add files diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b223457 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +rcon.yaml +csgo/* +csgo_cfg/* +csgo_maps/* +csgo_addons/* + diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..79bca7e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,43 @@ +FROM bitnami/minideb:bullseye + +ENV USER csgo +ENV HOME /server +ENV SOURCEMODVERSION 1.11 +ENV METAMODVERSION 1.11 +ENV CSGOSERVER $HOME/csgo +ENV STARTARGS "+game_type 0 +game_mode 1" +ENV TICKRATE 102.4 + +RUN install_packages lib32stdc++6 lib32gcc-s1 wget gzip curl ca-certificates nano locales net-tools \ + && echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \ + && locale-gen en_US.UTF-8 \ + && update-locale LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8 \ + && dpkg-reconfigure --frontend=noninteractive locales \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN adduser --disabled-password --gecos "" --home $HOME $USER + +ADD run.sh / +ADD csgo_ds.txt $HOME +ADD autoexec.cfg $HOME +ADD server.cfg $HOME + +RUN mkdir -p $CSGOSERVER/csgo && \ + mkdir $HOME/Steam && \ + mkdir $CSGOSERVER/csgo/maps $CSGOSERVER/csgo/cfg $CSGOSERVER/csgo/addons && \ + chown csgo:csgo -R /server && chown csgo:csgo /run.sh +RUN chmod +x /run.sh + +RUN curl -fsSL https://github.com/gorcon/rcon-cli/releases/download/v0.10.3/rcon-0.10.3-amd64_linux.tar.gz | tar -C . -xz +RUN mv rcon-0.10.3-amd64_linux/rcon /usr/local/bin + +USER csgo +WORKDIR $HOME + +EXPOSE 27015 + +# VOLUME $CSGOSERVER/csgo/cfg +# VOLUME $CSGOSERVER/csgo/maps +# VOLUME $CSGOSERVER/csgo/sourcemod + +CMD ["/run.sh"] diff --git a/autoexec.cfg b/autoexec.cfg new file mode 100644 index 0000000..40266da --- /dev/null +++ b/autoexec.cfg @@ -0,0 +1,6 @@ +log on +hostname "Zio" +rcon_password "9dbb40d076c4df840899d7f16de0f206" +sv_password "9dbb40d076c4df840899d7f16de0f206" +sv_cheats 0 +sv_lan 0 diff --git a/csgo_ds.txt b/csgo_ds.txt new file mode 100644 index 0000000..a37d27e --- /dev/null +++ b/csgo_ds.txt @@ -0,0 +1,4 @@ +force_install_dir /server/csgo +login anonymous +app_update 740 validate +quit \ No newline at end of file diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..ff608c4 --- /dev/null +++ b/run.sh @@ -0,0 +1,68 @@ +#!/usr/bin/env bash + +GREEN='\033[0;32m' +BLUE='\033[0;33m' +NC='\033[0m' + +replace_variable () { + echo -e "${BLUE}Setting $2 to $3 in $1" + mv $CSGOSERVER/csgo/cfg/$1 $CSGOSERVER/csgo/cfg/$1.tmp + cat $CSGOSERVER/csgo/cfg/$1.tmp | grep -v $2 > $CSGOSERVER/csgo/cfg/$1 + echo "$2 $3" >> $CSGOSERVER/csgo/cfg/$1 + rm $CSGOSERVER/csgo/cfg/$1.tmp +} + +if [[ ! -f "$HOME/Steam/steamcmd.sh" ]]; then + echo -e "${BLUE}Steam not found, downloading${NC}" + curl -fsSL https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz | tar -C $HOME/Steam -xz + echo -e "${GREEN}Steam downloaded and extracted to $HOME/Steam${NC}" +fi + +if [[ $RUNSCRIPT ]]; then + Steam/steamcmd.sh +runscript $HOME/csgo_ds.txt +fi + +if [[ ! -d "$CSGOSERVER/csgo/addons/metamod" ]]; then + echo -e "${BLUE}Metamod not installed, downloading v$METAMODVERSION${NC}" + curl -fsSL "https://www.metamodsource.net/latest.php?version=$METAMODVERSION&os=linux" | tar -C $CSGOSERVER/csgo -xz + echo -e "${GREEN}Metamod installed.${NC}" +fi + +if [[ ! -d "$CSGOSERVER/csgo/addons/sourcemod" ]]; then + echo -e "${BLUE}Sourcemode not installed, downloading v$SOURCEMODVERSION${NC}" + curl -fsSL "http://sourcemod.net/latest.php?version=$SOURCEMODVERSION&os=linux" | tar -C $CSGOSERVER/csgo -xz + echo -e "${GREEN}Sourcemod installed.${NC}" +fi + +if [[ -f "/server/server.cfg" ]]; then + echo -e "${BLUE}Moving server.cfg${NC}" + mv /server/server.cfg $CSGOSERVER/csgo/cfg/server.cfg +fi + +if [[ -f "/server/autoexec.cfg" ]]; then + echo -e "${BLUE}Moving autoexec.cfg${NC}" + mv /server/autoexec.cfg $CSGOSERVER/csgo/cfg/autoexec.cfg +fi + +if [[ $RCON_PASSWORD ]]; then + echo -e "default:\n address: \"127.0.0.1:27015\"\n password: \"${RCON_PASSWORD}\"" > "$HOME/rcon.yaml" + replace_variable "autoexec.cfg" "rcon_password" "\"$RCON_PASSWORD\"" +fi + +if [[ $SERVER_PASSWORD ]]; then + replace_variable "autoexec.cfg" "sv_password" "\"$SERVER_PASSWORD\"" +fi + +if [[ $SERVER_HOSTNAME ]]; then + replace_variable "autoexec.cfg" "hostname" "\"$SERVER_HOSTNAME\"" +fi + +if [[ $TICKRATE ]]; then + replace_variable "server.cfg" sv_mincmdrate $TICKRATE + replace_variable "server.cfg" sv_maxcmdrate $TICKRATE +fi + +echo -e "${GREEN}Starting csgo${NC}" +csgo/srcds_run -game csgo -tickrate $TICKRATE -autoupdate -steam_dir $CSGOSERVER/csgo \ +-steamcmd_script $CSGOSERVER/csgo/csgo_ds.txt -console -usercon +sv_setsteamaccount $STEAMTOKEN \ +-net_port_try 1 $STARTARGS diff --git a/server.cfg b/server.cfg new file mode 100644 index 0000000..4cb31cd --- /dev/null +++ b/server.cfg @@ -0,0 +1,21 @@ +sv_maxrate 0 +sv_minrate 30000 +sv_maxcmdrate TICKRATE +sv_mincmdrate TICKRATE + +bot_quota 0 +mp_autoteambalance 0 +mp_freezetime 0 +mp_limitteams 0 +sv_airaccelerate 190 +sv_staminamax 0 +sv_staminajumpcost 0 +sv_staminalandcost 0 +sv_autobunnyhopping 0 +sv_enablebunnyhopping 0 +mp_solid_teammates 0 +mp_friendlyfire 0 +mp_humanteam any +mp_maxrounds 20 +mp_forcecamera 0 +bot_kick