Added initial project
This commit is contained in:
parent
02e0585abc
commit
be978927f6
39
Dockerfile
Normal file
39
Dockerfile
Normal file
@ -0,0 +1,39 @@
|
||||
FROM debian:bookworm-slim
|
||||
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN dpkg --add-architecture i386 \
|
||||
&& apt-get update \
|
||||
&& apt-get install -y --no-install-recommends \
|
||||
ca-certificates \
|
||||
curl \
|
||||
socat \
|
||||
tini \
|
||||
winbind \
|
||||
xvfb \
|
||||
xauth \
|
||||
cabextract \
|
||||
unzip \
|
||||
wine \
|
||||
wine64 \
|
||||
wine32 \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
ENV WINEPREFIX=/wineprefix
|
||||
ENV WINEARCH=win64
|
||||
ENV WINEDEBUG=-all
|
||||
|
||||
WORKDIR /opt/ns2
|
||||
COPY . /opt/ns2
|
||||
|
||||
RUN chmod +x /opt/ns2/docker-entrypoint.sh
|
||||
|
||||
RUN mkdir -p /data/config /data/mods /data/logs \
|
||||
&& mkdir -p "${WINEPREFIX}" \
|
||||
&& xvfb-run -a wineboot -u
|
||||
|
||||
EXPOSE 27015/udp 27016/udp 8080/tcp
|
||||
|
||||
VOLUME ["/data"]
|
||||
|
||||
ENTRYPOINT ["/usr/bin/tini","--","/opt/ns2/docker-entrypoint.sh"]
|
||||
36
build_steps.md
Normal file
36
build_steps.md
Normal file
@ -0,0 +1,36 @@
|
||||
## Basic Build steps for local image
|
||||
|
||||
```bash
|
||||
docker system prune -a -f
|
||||
|
||||
docker compose up --build
|
||||
```
|
||||
|
||||
|
||||
## Tagging and pushing an image for VeritableValor/ns2-server-docker
|
||||
|
||||
Assuming you built an image locally (example image name: ns2-server) and you want to push to Docker Hub under the repo VeritableValor/ns2-server-docker:
|
||||
|
||||
### Log in (if not already):
|
||||
|
||||
```bash
|
||||
docker login gitea.veritablevalor.com
|
||||
```
|
||||
|
||||
### Tag the image for Docker Hub (replace IMAGE_ID or local-name and VERSION as needed):
|
||||
|
||||
```bash
|
||||
docker tag local-image:tag gitea.veritablevalor.com/VeritableValor/ns2-server-docker:version
|
||||
```
|
||||
|
||||
Or using image ID:
|
||||
|
||||
```bash
|
||||
docker tag <IMAGE_ID> gitea.veritablevalor.com/VeritableValor/ns2-server-docker:version
|
||||
```
|
||||
|
||||
### Push:
|
||||
|
||||
```bash
|
||||
docker push gitea.veritablevalor.com/VeritableValor/ns2-server-docker:version
|
||||
```
|
||||
42
docker-compose.yml
Normal file
42
docker-compose.yml
Normal file
@ -0,0 +1,42 @@
|
||||
services:
|
||||
ns2-dedicated:
|
||||
# image: naturalselection2-ns2-dedicated
|
||||
build: .
|
||||
container_name: ns2-dedicated
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
NS2_IP: 0.0.0.0
|
||||
NS2_GAME_PORT: 27015
|
||||
NS2_INSECURE: "1"
|
||||
NS2_WEBADMIN: "1"
|
||||
NS2_WEB_PORT: 8080
|
||||
NS2_NAME: "NS2 Docker Server"
|
||||
NS2_MAP: "ns2_summit"
|
||||
NS2_LIMIT: 24
|
||||
NS2_CONFIG_PATH: "/data/config"
|
||||
NS2_MODSTORAGE: "/data/mods"
|
||||
NS2_LOGDIR: "/data/logs"
|
||||
NS2_WEBUSER: "admin"
|
||||
NS2_WEBPASSWORD: "admin"
|
||||
# NS2_WEBUSERS_FILE: "/data/config/users.htpasswd"
|
||||
ports:
|
||||
- "27015:27015/udp"
|
||||
- "27016:27016/udp"
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./docker-data:/data
|
||||
|
||||
# If you prefer passing command-line args directly instead of env vars:
|
||||
# command:
|
||||
# - -ip
|
||||
# - 0.0.0.0
|
||||
# - -port
|
||||
# - "27015"
|
||||
# - -insecure
|
||||
# - -webadmin
|
||||
# - -webport
|
||||
# - "80"
|
||||
# - -name
|
||||
# - "NS2 Docker Server"
|
||||
# - -map
|
||||
# - "ns2_summit"
|
||||
96
docker-entrypoint.sh
Normal file
96
docker-entrypoint.sh
Normal file
@ -0,0 +1,96 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
: "${NS2_GAME_PORT:=27015}"
|
||||
: "${NS2_WEB_PORT:=8080}"
|
||||
: "${NS2_WEB_INTERNAL_PORT:=8081}"
|
||||
: "${NS2_IP:=0.0.0.0}"
|
||||
|
||||
if [[ "${NS2_DEBUG:-0}" == "1" ]]; then
|
||||
set -x
|
||||
fi
|
||||
|
||||
ARGS=()
|
||||
ARGS+=("-ip" "${NS2_IP}")
|
||||
ARGS+=("-port" "${NS2_GAME_PORT}")
|
||||
|
||||
if [[ "${NS2_INSECURE:-0}" == "1" ]]; then
|
||||
ARGS+=("-insecure")
|
||||
fi
|
||||
|
||||
if [[ "${NS2_WEBADMIN:-0}" == "1" ]]; then
|
||||
ARGS+=("-webadmin" "-webport" "${NS2_WEB_INTERNAL_PORT}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_NAME:-}" ]]; then
|
||||
ARGS+=("-name" "${NS2_NAME}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_MAP:-}" ]]; then
|
||||
ARGS+=("-map" "${NS2_MAP}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_LIMIT:-}" ]]; then
|
||||
ARGS+=("-limit" "${NS2_LIMIT}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_PASSWORD:-}" ]]; then
|
||||
ARGS+=("-password" "${NS2_PASSWORD}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_WEBUSER:-}" ]]; then
|
||||
ARGS+=("-webuser" "${NS2_WEBUSER}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_WEBPASSWORD:-}" ]]; then
|
||||
ARGS+=("-webpassword" "${NS2_WEBPASSWORD}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_WEBDOMAIN:-}" ]]; then
|
||||
ARGS+=("-webdomain" "${NS2_WEBDOMAIN}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_WEBUSERS_FILE:-}" ]]; then
|
||||
ARGS+=("-webusers" "${NS2_WEBUSERS_FILE}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_MODSTORAGE:-}" ]]; then
|
||||
ARGS+=("-modstorage" "${NS2_MODSTORAGE}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_CONFIG_PATH:-}" ]]; then
|
||||
ARGS+=("-config_path" "${NS2_CONFIG_PATH}")
|
||||
fi
|
||||
|
||||
if [[ -n "${NS2_LOGDIR:-}" ]]; then
|
||||
ARGS+=("-logdir" "${NS2_LOGDIR}")
|
||||
fi
|
||||
|
||||
cd /opt/ns2
|
||||
|
||||
if [[ "${NS2_WEBADMIN:-0}" == "1" ]] && [[ "${NS2_WEB_PROXY:-1}" == "1" ]]; then
|
||||
if command -v socat >/dev/null 2>&1; then
|
||||
echo "[ns2] starting web proxy: 0.0.0.0:${NS2_WEB_PORT} -> 127.0.0.1:${NS2_WEB_INTERNAL_PORT}" >&2
|
||||
socat TCP-LISTEN:"${NS2_WEB_PORT}",fork,reuseaddr,bind=0.0.0.0 TCP:127.0.0.1:"${NS2_WEB_INTERNAL_PORT}" &
|
||||
else
|
||||
echo "[ns2] warning: socat not installed; cannot start web proxy" >&2
|
||||
fi
|
||||
fi
|
||||
|
||||
WINE_BIN=""
|
||||
if command -v wine64 >/dev/null 2>&1; then
|
||||
WINE_BIN="wine64"
|
||||
elif command -v wine >/dev/null 2>&1; then
|
||||
WINE_BIN="wine"
|
||||
else
|
||||
echo "[ns2] error: wine executable not found in PATH" >&2
|
||||
exit 127
|
||||
fi
|
||||
|
||||
if [[ $# -gt 0 ]]; then
|
||||
echo "[ns2] launching: ${WINE_BIN} x64/Server.exe $*" >&2
|
||||
exec "${WINE_BIN}" x64/Server.exe "$@"
|
||||
fi
|
||||
|
||||
echo "[ns2] launching: ${WINE_BIN} x64/Server.exe ${ARGS[*]}" >&2
|
||||
exec "${WINE_BIN}" x64/Server.exe "${ARGS[@]}"
|
||||
Loading…
x
Reference in New Issue
Block a user