From 113065f09e16a337102033785a9b43bd252d3e29 Mon Sep 17 00:00:00 2001 From: Alex Macocian Date: Mon, 11 Nov 2024 15:25:53 +0100 Subject: [PATCH] Initial commit --- Dockerfile | 44 ++++++++++++++++++++++++++++++++++++++++++++ docker-compose.yml | 35 +++++++++++++++++++++++++++++++++++ install.sh | 39 +++++++++++++++++++++++++++++++++++++++ start.sh | 11 +++++++++++ 4 files changed, 129 insertions(+) create mode 100644 Dockerfile create mode 100644 docker-compose.yml create mode 100644 install.sh create mode 100644 start.sh diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..520170f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,44 @@ +FROM ubuntu:24.04 + +EXPOSE 28015 +EXPOSE 28016 + +RUN apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y && apt-get autoremove -y && apt-get install -y locales + +ENV LANG en_US.UTF-8 +ENV LANGUAGE en_US:en +ENV LC_ALL en_US.UTF-8 + +RUN locale-gen en_US.UTF-8 && update-locale LANG=en_US.UTF-8 + +ENV DEBIAN_FRONTEND noninteractive + +RUN apt-get install -y \ + ca-certificates \ + software-properties-common \ + lib32gcc-s1 \ + libstdc++6 \ + curl \ + wget \ + build-essential \ + jq + +RUN mkdir -p /steamcmd +RUN mkdir -p /starbound + +WORKDIR "/starbound" + +RUN cd /steamcmd \ + && wget -o /tmp/steamcmd.tar.gz http://media.steampowered.com/installer/steamcmd_linux.tar.gz \ + && tar zxvf steamcmd_linux.tar.gz \ + && rm steamcmd_linux.tar.gz \ + && chmod +x ./steamcmd.sh + +WORKDIR / + +RUN /steamcmd/steamcmd.sh +force_install_dir /starbound/ +quit + +COPY start.sh /start.sh +COPY install.sh /install.sh + +ENTRYPOINT ["./start.sh"] \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7704fba --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,35 @@ +services: + install: + build: . + environment: + - TZ=Europe/London + volumes: + - steam-data:/root/Steam + - type: bind + source: D:/temp/starbound + target: /starbound + bind: + create_host_path: true + tty: true + stdin_open: true + entrypoint: ./install.sh + network_mode: bridge + server: + build: . + environment: + - TZ=Europe/London + volumes: + - steam-data:/root/Steam + - type: bind + source: D:/temp/starbound + target: /starbound + bind: + create_host_path: true + ports: + - '28015:28015/udp' + - '28016:28016/udp' + restart: unless-stopped + network_mode: bridge + +volumes: + steam-data: \ No newline at end of file diff --git a/install.sh b/install.sh new file mode 100644 index 0000000..a2ea77e --- /dev/null +++ b/install.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +read -p "Enter Steam username: " STEAM_USER +read -sp "Enter Steam password: " STEAM_PASSWORD +echo + +/steamcmd/steamcmd.sh \ + +force_install_dir /starbound/ \ + +login "$STEAM_USER" "$STEAM_PASSWORD" \ + +app_update 211820 validate \ + +quit + +# Check if the SteamCMD login was successful +if [ $? -ne 0 ]; then + echo "SteamCMD failed. Check the output for more details." + exit 1 +fi + +response=$(curl -s "https://api.github.com/repos/xStarbound/xStarbound/releases/latest") + +# Extract the tag name and download URL using jq +tag_name=$(echo "$response" | jq -r '.tag_name') +download_url=$(echo "$response" | jq -r '.assets[] | select(.name == "linux-static.tar.gz") | .browser_download_url') + +if [ -n "$download_url" ]; then + echo "Downloading linux-static.tar.gz from the latest release..." + curl -L "$download_url" -o /tmp/linux-static.tar.gz + + echo "Extracting linux-static.tar.gz ..." + tar -xzf /tmp/linux-static.tar.gz -C /starbound/steamapps/common/Starbound/server + + echo "Cleaning up downloaded file..." + rm /tmp/linux-static.tar.gz + + echo "Download and extraction completed successfully." +else + echo "No linux-static.tar.gz asset found in the latest release." + exit 1 +fi \ No newline at end of file diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..32a5bb5 --- /dev/null +++ b/start.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +cd /starbound/steamapps/common/Starbound/server +chmod +x xserver.sh +./xserver.sh + +while : +do + echo "Press [CTRL+C] to stop.." + sleep 1 +done \ No newline at end of file