mirror of
https://github.com/tbamud/tbamud.git
synced 2025-09-21 21:40:49 +02:00
1
Docker
atebyagrue edited this page 2024-06-05 17:06:15 -04:00
Table of Contents
Docker
Summary
These instructions will allow you run tbaMUD inside of a Docker container on your computer (any OS) with no manual configuration or additional software installation necessary.
- It will setup a Ubuntu 18.04 container running the game over port 4000.
- Any changes to your game code will require you to rebuild & restart the container.
- Could improvements be made? Sure.
- Could this be a bit cleaner or more efficient? You betcha.
- I just wanted to get this out there so that it'd be even easier for folks who would like to see the game running, to be able to.
Requirements
install Docker & docker-compose for whatever platform you wish to run as the game server.
Setup
- edit the files to your liking
- add Dockerfile & docker-compose.yaml to the base directory of the project (folder with /src).
Files
Dockerfile
FROM ubuntu:18.04
# EXPOSE 4000
# Set timezone
ENV TZ="America/New_York"
RUN date
# Update and Install
RUN apt update && apt upgrade -y
RUN apt-get install -y automake make gcc g++ clang libtool autoconf zlib1g-dev libcurl4-openssl-dev wget build-essential vim telnet dos2unix
# apt cleanup
RUN rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Setup App Area (COPY releative to Dcokerfile location...)
RUN mkdir -p /app
COPY . /app
WORKDIR /app
# Remove Windows CRLF & compile
RUN find /app -type f -print0 | xargs -0 dos2unix --
RUN chmod +x /app/configure && ./configure
RUN cd /app/src && make all
# Run tbamUD server
ENTRYPOINT ["sh", "/app/autorun", "&"]
# Debug Container
# ENTRYPOINT ["tail", "-f", "/dev/null"]
docker-compose.yaml
services:
tbamud:
build:
context: .
dockerfile: Dockerfile
container_name: tbamud_cn
# env_file:
# - ./EXAMPLE.env
ports:
- 4001:4000
volumes:
- ./shared:/mnt/shared
environment:
- Key=Value
Use
Startup
- on CLI, change to base directory
- docker-compose up -d
- this will build the server image that the container will run, with all the dependencies needed to compile & run tbaMUD
- then it will start the gameserver container
Shutdown
- on CLI, change to base directory
- docker-compose down
- this will stop the game server container
Troubleshooting
- ERR: I honestly do not see how this any error could occur if you have Docker running on your machine, except maybe a port conflict.
- Cause: is it plugged in?
- Remediation: plug it in.