Skip to content

Instantly share code, notes, and snippets.

@leviyehonatan
Last active February 7, 2019 13:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save leviyehonatan/55478cbf40986d8fce5cfa2019300af6 to your computer and use it in GitHub Desktop.
Save leviyehonatan/55478cbf40986d8fce5cfa2019300af6 to your computer and use it in GitHub Desktop.
dayzz dockerized

Dockerized Dayzz

Install

brew cask install docker       # Install Docker
open /Applications/Docker.app  # Start Docker

Run

and then in the dayz-server dir:

docker-compose up

it runs the mongo and redis, and uses ../data for the mongo storage

Access

if you need to run npm install or anything just do

$ docker ps
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                  NAMES
0a9d6571de68        node:8              "npm start"              23 minutes ago      Up 12 minutes       0.0.0.0:3000->3000/tcp   dayzz-server_server_1
820ef316b25c        mongo               "docker-entrypoint.s…"   23 minutes ago      Up 12 minutes       27017/tcp                dayzz-server_mongo_1
64e8f9ba2081        redis               "docker-entrypoint.s…"   32 minutes ago      Up 12 minutes       6379/tcp                 dayzz-server_redis_1

to see the name of the server and run

$ docker exec -ti dayzz-server_server_1 sh

to get a shell to the actual machine (on another terminal)

or just the npm install directly

$ docker exec -ti dayzz-server_server_1 npm install

notice the use of node:8. basically you don't have to install anything locally so it makes the process of setting up a new environment a breeze

version: "3"
services:
server:
image: node:8
volumes:
- ./:/app
working_dir: /app
depends_on:
- mongo
environment:
NODE_ENV: development
REDIS_URL: redis://redis:6379
MONGO_CONNECTION: mongodb://mongo:27017/database
ports:
- 3000:3000
command: npm start
mongo:
image: mongo
expose:
- 27017
volumes:
- ../data/db:/data/db
redis:
image: redis
expose:
- 6379
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment