Skip to content

Commit

Permalink
blablabla
Browse files Browse the repository at this point in the history
  • Loading branch information
AMD-NICK committed Dec 19, 2024
1 parent 15c0e90 commit 3adba6c
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 26 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

35 changes: 21 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
<p align="center">
<a href="#">
<img src="https://img.qweqwe.ovh/docker-gmod.png"></a>
<img src="https://img.qweqwe.ovh/docker-gmod.png">
</p>

<p align="center">
<!-- <p align="center">
<a href="https://hub.docker.com/r/defaced/gmod-server/">
<img src="https://img.shields.io/docker/build/defaced/gmod-server.svg"></a>
<a href="https://hub.docker.com/r/defaced/gmod-server/">
<img src="https://img.shields.io/docker/pulls/defaced/gmod-server.svg"></a>
<a href="https://hub.docker.com/r/defaced/gmod-server/">
<img src="https://img.shields.io/docker/stars/defaced/gmod-server.svg"></a>
</p>
</p> -->

<p align="center">
<a href="https://github.com/AMD-NICK/docker-garrysmod-server/stargazers">
Expand All @@ -24,38 +23,46 @@


# Dockerized Garry's Mod server

Runs your Garry's Mod server inside Docker container as an executable

# Features
## Features

- Gmod running under non-root user (steam)
- Working luarefresh. You can update your scripts and changes will apply instantly
- Installed CSS content
- You can run commands in your container like it's not containered server
- Correct `GetConVarString("hostip")` if run with docker-compose (just edit ip inside .env)
- Correct `GetConVarString("hostip")` if run with docker-compose (if you edit ip inside .env)
- tmysql4, luasocket and some .dll modules works fine

# Example
For detailed info look inside start.sh and docker-compose.yml
## Examples

For advanced example and docker-compose file look inside [example folder](/example).

Also you can run your server with `docker run`. Simple example:

```bash
docker build -t gmod-server . ; docker run --rm -it --name gmod \
-p 27015:27015/udp \
-v $PWD/volume/addons:/gmodserv/garrysmod/addons/ \
-v $PWD/addons:/gmodserv/garrysmod/addons/ \
gmod-server \
-port 27015 \
-tickrate 32 \
-maxplayers 8 \
+map gm_construct \
```

# Notes
## Notes

- This image requires ~10GB of free space
- All you need (addons, data, gamemodes) located in `/gmodserv/garrysmod`
- This image requires ~7GB of free space
- Main locations inside containter is `/gmodserv/garrysmod`, `/gmodserv/steamcmd` and `/gmodserv/content/css`
- Ready to use (builded) images located on ghcr.io, not on docker hub
- Such modules like `gmsv_socket_linux.dll` requires additional port forwarding rules. Example. If you plan to use `27030/tcp` then you need to add following option to `docker run` command: `-p 27030:27030/tcp`
- The next useful thing it's `--rm` option. If you use it the container will automatically removed after srcds process being killed. You should not remove trash containers by hands with this param
- `--name anyname` assign pretty name to your container

## docker run tips and tricks

- `--rm` option. If you use it the container will automatically removed after srcds process being killed. You should not remove trash containers by hands with this param
- `--name anyname` assign pretty name to your container, so you can delete it by name instead of hash
- `-d` option runs container in background. You can attach them with `docker attach container_name` (don't use with --rm).
- `-it` there is 2 options where -t allocate a pseudo-TTY (required) and -i which allow you to interact with gmod console (run commands etc)
- `docker logs -f container_name` let's receive logs from server!
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
addons/ulx_ulib
darkrp
data/*
6 changes: 6 additions & 0 deletions example/addons/anyname/lua/autorun/somefile.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
local global_I = cookie.GetNumber("key_from_sv_db", 0) + 1
cookie.Set("key_from_sv_db", global_I)

for i = 1, 10 do
print("Hello world! It's a " .. global_I .. " time when this server starts")
end
4 changes: 1 addition & 3 deletions docker-compose.yml → example/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
version: "2"

services:
gmod:
build:
context: .
context: ..
command: -port $PORT \
-tickrate 32 \
-maxplayers 16 \
Expand Down
13 changes: 5 additions & 8 deletions test.sh → example/start.sh
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
#!/bin/bash

# Run clean darkrp server with ulx admin mode

# git clone https://github.com/AMD-NICK/docker-garrysmod-server.git gmod-docker
# cd gmod-docker
# docker build -t gmod:1 .
# sh test.sh
# sh start.sh

mkdir -p volume ; cd volume
mkdir -p addons data luabin gmas
touch sv.db

chown 999:999 sv.db data/ gmas/
chown 1000:1000 sv.db data/ gmas/

if [ ! -d "darkrp" ]; then
echo "Installing DarkRP"
git clone https://github.com/FPtje/DarkRP.git darkrp
fi


if [ ! -d "addons/ulx_ulib" ]; then
echo "Installing Ulx and Ulib"

Expand All @@ -35,5 +33,4 @@ if [ ! -d "addons/ulx_ulib" ]; then
rm -rf tmp
fi

cd .. # exit from /volume
docker-compose up --force-recreate
docker compose up --force-recreate
Binary file added example/sv.db
Binary file not shown.

0 comments on commit 3adba6c

Please sign in to comment.