Skip to content

Commit

Permalink
Init 🚀 (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesIves authored Jun 12, 2024
1 parent 26cf3cd commit 3ccc3e3
Show file tree
Hide file tree
Showing 11 changed files with 169 additions and 1 deletion.
27 changes: 27 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build Docker Image
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: .
push: true
tags: jives/hlds:cstrike
61 changes: 61 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Docs: https://developer.valvesoftware.com/wiki/SteamCMD

# Use the latest version of Ubuntu as the base image
FROM ubuntu:latest

# Define variables for the username, volume directory, and game
ENV USERNAME=steam
ENV CONFIG_DIR=src
ENV INSTALL_DIR=hlds
ENV MOD=cstrike

# Update the package list and install the necessary packages
RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends curl file libc6:i386 lib32stdc++6 ca-certificates rsync && \
rm -rf /var/lib/apt/lists/*

# Create a user for the SteamCMD and game
RUN groupadd -r $USERNAME && \
useradd -r -g $USERNAME -m -d /opt/$USERNAME $USERNAME

# Create a directory for the game using the CONFIG_DIR variable
RUN mkdir /$CONFIG_DIR
USER $USERNAME
WORKDIR /opt/$USERNAME

# Copy the hlds.txt file to the container
COPY ./hlds.txt /opt/$USERNAME

# Download and install SteamCMD
RUN curl -v -sL media.steampowered.com/client/installer/steamcmd_linux.tar.gz | tar xzvf - && \
file /opt/$USERNAME/linux32/steamcmd && \
./steamcmd.sh +force_install_dir ./$INSTALL_DIR +app_set_config 90 mod $MOD +runscript hlds.txt

# Create a symbolic link to the Steam SDK
RUN mkdir -p $HOME/.steam && \
ln -s /opt/$USERNAME/linux32 $HOME/.steam/sdk32 && \
echo 70 > /opt/$USERNAME/$INSTALL_DIR/steam_appid.txt

# Expose the necessary ports for the game
WORKDIR /opt/$USERNAME/$INSTALL_DIR


# Copy configs, Metamod, Stripper2 and AMX.
COPY --chown=steam:steam $CONFIG_DIR $MOD
COPY --chown=steam:steam ./entrypoint.sh ./entrypoint.sh

# Add execute permissions to the entrypoint.sh script
RUN chmod +x ./entrypoint.sh

EXPOSE 27015
EXPOSE 27015/udp

# Start server.
ENTRYPOINT ["./entrypoint.sh", "-timeout 3"]

# Default start parameters.
CMD ["+maxplayers 12", "+map cs_italy"]

RUN ls $MOD -la

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# hlds-docker
# hlds-dockerr
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: "3.7"

services:
hlds:
build: docker
image: jives/hlds:cstrike
volumes:
- "./src:/tmp/src"
command: +maxplayers 12 +map cs_italy +rcon_password "supersecret" +log on +logaddress 0.0.0.0 27500
network_mode: "host"
10 changes: 10 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

if [ -d /tmp/$CONFIG_DIR ]
then
rsync --chown=steam:steam /tmp/$CONFIG_DIR/* /opt/steam/$INSTALL_DIR/$MOD
fi

echo Starting server...

./hlds_linux "$@"
7 changes: 7 additions & 0 deletions hlds.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@ShutdownOnFailedCommand 0
@NoPromptForPassword 1
login anonymous
app_update 90
app_update 90 validate
app_update 90 validate
quit
2 changes: 2 additions & 0 deletions src/autoexec.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// Add server configurations to default.cfg
exec default.cfg
29 changes: 29 additions & 0 deletions src/default.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// For almost full list of server comamnds visit:
// http://sr-team.clan.su/K_stat/hlcommandsfull.html

// This sets the config file which is loaded at each map change.
hostname "Counter-Strike Server"

mp_autocrosshair "0"
mp_falldamage "0"
mp_logdetail "1"
mp_logfile "0"
mp_timelimit "120"
pausable "0"
secure "1"
sv_aim "0"
sv_allowupload "0"
sv_contact "jives.dev"
sv_proxies "0"
sv_region "3"
sv_minrate "1000"
sv_maxrate "100000"
sv_minupaterate "60"
sv_maxupaterate "101"
sv_password "test"

// voice
sv_alltalk "1"
sv_voicecodec voice_speex
sv_voiceenable "1"
sv_voicequality "3"
19 changes: 19 additions & 0 deletions src/liblist.gam
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
game "Counter-Strike"
url_info "www.counter-strike.net"
url_dl ""
version "1.6"
size "184000000"
svonly "0"
secure "1"
type "multiplayer_only"
cldll "1"
hlversion "1111"
nomodels "1"
nohimodel "1"
mpentity "info_player_start"
//gamedll "dlls\mp.dll"
//gamedll_linux "dlls/cs.so"
//gamedll_osx "dlls/cs.dylib"
trainmap "tr_1"
gamedll "addons\metamod\dlls\metamod.dll"
gamedll_linux "addons/metamod/dlls/metamod.so"
1 change: 1 addition & 0 deletions src/mapcycle.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
cs_italy
2 changes: 2 additions & 0 deletions src/motd.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Test MOTD
https://jives.dev

0 comments on commit 3ccc3e3

Please sign in to comment.