Giter Club home page Giter Club logo

cs16-docker's Introduction

Docker GitHub

Counter-Strike 1.6 Docker Server

Powered by Docker, Terraform and Microsoft Azure.

A Docker image for Counter-Strike 1.6 dedicated servers. Bundled with custom maps, Metamod and AMX Mod X. Supports deployment to Microsoft Azure via Terraform.

Getting Started

Run Locally

To start the Docker container locally, open a command shell and execute:

docker run -d --rm -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp -p 26900:26900/udp --name cs16 paschi/cs16

This will open the required ports and start the server. You can then start your CS 1.6 client and should see the server listed under "Find Servers > LAN". If you're running the container on WSL2 and the server is not displayed or you can't connect to it, you may need to connect directly to the IP that is listed when running ifconfig:

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 172.29.23.5  netmask 255.255.240.0  broadcast 172.29.79.255

Open the console in your CS 1.6 client and enter connect 172.29.23.5 to connect to the server.

To stop and remove the Docker container, run:

docker stop cs16

Cloud Deployment

The Terraform configurations in the terraform directory allow deploying the Docker image to Microsoft Azure. To start the deployment, run this code after authenticating using the Azure CLI:

cd terraform

# initialize the working directory for use with Terraform
terraform init

# create an execution plan for the deployment
terraform plan

# execute the plan and create the required resources in Azure
terraform apply
# input: yes

If the deployment was successful, terraform apply will output the IP address of the server:

Apply complete! Resources: 2 added, 0 changed, 0 destroyed.
Outputs:
ip_address = "20.113.8.157"

To clean up the deployment and remove all created resources:

terraform destroy
# input: yes

Development

Building

In order to build the Docker image, run this code:

docker build -t paschi/cs16 .

Publishing

To publish the Docker image to a repository, perform these steps:

docker image tag paschi/cs16 registry-host:5000/myuser/cs16:latest
docker image push registry-host:5000/myuser/cs16:latest

This will tag the the previously built image as myuser/cs16:latest and push it to the registry at registry-host:5000.

Configuration

The Docker image can be configured via environment variables:

docker run -d --rm -p 27015:27015/tcp -p 27015:27015/udp -p 27020:27020/udp -p 26900:26900/udp --name cs16 \
    -e SERVER_NAME="My CS 1.6 Server" -e MAP=de_aztec -e MAXPLAYERS=16 -e ADMIN_STEAM=0:1:12345 paschi/cs16
Environment Variable Default Value Description
SERVER_NAME CS 1.6 Server Name of the server.
MAP de_dust2 Start map.
MAXPLAYERS 24 Maximum number of players.
ADMIN_STEAM - Steam ID of the server admin (format: 0:1:12345).
SV_PASSWORD - Server password.
RCON_PASSWORD - RCON password.

For a full list of supported variables and their default values, see docker-entrypoint.sh.

cs16-docker's People

Contributors

paschi avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.