Added a second container that runs nightly server builds.

This commit is contained in:
surrealtm
2025-08-20 21:28:02 +02:00
parent dd943bcb8e
commit 0e3ba7ab8a
4 changed files with 49 additions and 10 deletions

View File

@@ -1,5 +1,13 @@
FROM debian:12.11-slim
# The server version can be either 'nightly' or 'stable' and will differ in the
# executable that is downloaded from github. These arguments are used at build-time
ARG SERVER_VERSION
ARG SERVER_PORT
# This one is used at run-time
ENV SERVER_VERSION ${SERVER_VERSION}
RUN apt-get update && apt-get install -y wget
ENV MAX_LOGS="20"
@@ -14,8 +22,8 @@ COPY ./scripts/download_server.sh ./
COPY ./scripts/server_script.sh ./
RUN chmod 777 ./*.sh
RUN ./download_server.sh
RUN ./download_server.sh $SERVER_VERSION
CMD ["./server_script.sh"]
CMD ./server_script.sh ${SERVER_VERSION}
EXPOSE 9876
EXPOSE $SERVER_PORT

View File

@@ -1,16 +1,37 @@
services:
glassminers_server:
glassminers_server_stable:
build:
context: .
dockerfile: Dockerfile
args:
- SERVER_VERSION=stable
- SERVER_PORT=9876
network: host
restart: unless-stopped
container_name: glassminers_server
container_name: glassminers_server_stable
environment:
- MAX_LOGS=20
# - LOG_DIR="/var/log/glassminers"
# - LOG_DATE_FORMAT="%Y-%m-%d-%H-%M-%S" # No spaces
volumes:
- ./logs:/var/log/glassminers
- ./logs:/var/log/glassminers_stable
ports:
- 9876:9876/tcp
glassminers_server_nightly:
build:
context: .
dockerfile: Dockerfile
args:
- SERVER_VERSION=nightly
- SERVER_PORT=9877
network: host
restart: unless-stopped
container_name: glassminers_server_nightly
environment:
- MAX_LOGS=20
# - LOG_DIR="/var/log/glassminers"
# - LOG_DATE_FORMAT="%Y-%m-%d-%H-%M-%S" # No spaces
volumes:
- ./logs:/var/log/glassminers_nightly
ports:
- 9877:9876/tcp

View File

@@ -1,13 +1,23 @@
#!/bin/bash
echo "[Info] Downloading latest server version..."
wget https://github.com/surrealtm/Glassminers/releases/latest/download/GMServer.out -O "server.out"
echo "[Info] Downloading server executable..."
LOCAL_EXECUTABLE_NAME="server_$1.out"
if [ "$1" = "stable" ]; then
wget https://github.com/surrealtm/Glassminers/releases/latest/download/GMServer.out -O $LOCAL_EXECUTABLE_NAME
elif [ "$1" = "nightly" ]; then
wget https://github.com/surrealtm/Glassminers/raw/refs/heads/main/run_tree/server.out -O $LOCAL_EXECUTABLE_NAME
else
echo "[Error] Please provide either 'nightly' or 'stable' as an argument to this script."
exit 1
fi
if [ $? -ne 0 ]; then
echo "[Error] Download failed! Aborting."
exit 1
fi
chmod 777 ./server.out
chmod 777 $LOCAL_EXECUTABLE_NAME
echo "[Info] Download completed successfully."

View File

@@ -4,7 +4,7 @@ MAX_LOGS=${MAX_LOGS:-20}
LOG_DIR=${LOG_DIR:-"/var/log/glassminers"}
LOG_DATE_FORMAT=${LOG_DATE_FORMAT:-"%Y-%m-%d-%H-%M-%S"}
EXEC=./server.out
EXEC=./server_$1.out
TIMESTAMP=$(date +"$LOG_DATE_FORMAT")
delete_old_logs() {