Varilla Posted June 20, 2021 Share Posted June 20, 2021 Hi everyone! 🖐️ Today I was a reading the "Getting started running a server" guide when I thought about putting the stuff in Docker, to be minimal as possible. Then, I came here to show you how to do it. You will need to create a folder with the name of your project, and inside it, we'll put only three files. You need to have Docker Desktop installed already. Step 1 - Dockerfile Create a file with the name Dockerfile, and without an extension. Inside it, paste the code below: FROM ubuntu:latest WORKDIR /opt/app COPY ./app /opt/app RUN chmod +x ragemp-server CMD ["./ragemp-server"] This will be our base system, based on Ubuntu 20.04 LTS (Linux dist). We are going to create an app folder inside opt (default by the system) and give permission to a file that we are going to add later. At the end, the Dockerfile starts the server with the command provided in the CMD directive. Step 2 - docker-compose.yml Create a file with the name docker-compose.yml, this will be our orchestrator: the file that manage all the services that the server needs in order to run properly. Paste the code below: version: "3.9" services: ragemp_server: build: . hostname: "ragemp_server" container_name: "ragemp_server" ports: - "22005:22005/udp" - "22006:22006" tty: true networks: default: external: name: ragemp_network This will add only one service called ragemp_server, and it'll contain the server files. The file will map the ports between the container and your PC. You will need to create the network with the following command: docker network create ragemp_network Step 3 - app folder Finally, you need to download the linux server files and extract them into the app folder. Once you got the files inside the app folder (you need to have the bin and dotnet folders, and the ragemp-server executable) you can run the following command in the root of the project: docker-compose up. This will create the container and run the server. Then, you can go to RageMP > Direct Connect > 127.0.0.1 : 22005 In my case, I'm running the server on a Macbook Pro and testing it on a Windows machine, so in that case you will need to run the ifconfig or ipconfig command to know your IP address, and then connect to it (i.e: 192.168.0.102:22005). Your machines need to be in the same network. Step 4 - (Optional) Get into the container If you need to get into the Ubuntu machine to run some commands, you can do it with the following cmd: docker exec -it container_name bash Replace container_name by the name of your container. Once inside, you can run whatever you want because you'll be the root user. If you have questions, please leave a comment and I'll be answering ASAP. I'm new at RageMP so I don't have a great knowledge about it, but I'm a programmer anyway 🤷♂️ Goodbye! 🖐️ 7 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now