Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding docker and docker-compose #17

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
FROM node:12

# Create app directory
WORKDIR /usr/src/app

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install
# If you are building your code for production
# RUN npm ci --only=production

# Bundle app source
COPY . .

EXPOSE 5000
CMD ["npm", "run", "dev"]
61 changes: 61 additions & 0 deletions backend/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
version: "3"

services:
mongo:
image: mongo
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: MongoDB2019!
ports:
- "27017:27017"
# volumes:
# - ./db:/data/db
# networks:
# - mongo-compose-network

nodejs:
build:
context: .
dockerfile: Dockerfile
image: nodejs
depends_on:
- mongo
- teamspeak
container_name: nodejs
restart: unless-stopped
env_file:
- .env
ports:
- "5000:5000"
volumes:
- .:/app
- node_modules:/app/node_modules
links:
- mongo
- teamspeak

teamspeak:
image: teamspeak
restart: always
ports:
- 9987:9987/udp
- 10011:10011
- 30033:30033
environment:
TS3SERVER_DB_PLUGIN: ts3db_mariadb
TS3SERVER_DB_SQLCREATEPATH: create_mariadb
TS3SERVER_DB_HOST: db
TS3SERVER_DB_USER: root
TS3SERVER_DB_PASSWORD: example
TS3SERVER_DB_NAME: teamspeak
TS3SERVER_DB_WAITUNTILREADY: 30
TS3SERVER_LICENSE: accept
db:
image: mariadb
restart: always
environment:
MYSQL_ROOT_PASSWORD: example
MYSQL_DATABASE: teamspeak

volumes:
node_modules:
2 changes: 1 addition & 1 deletion backend/utils/ts3.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require('dotenv').config()
const { TeamSpeak } = require("ts3-nodejs-library")

const ts3Query = new TeamSpeak({
host: "localhost",
host: "teamspeak",
serverport: 9987,
username: "serveradmin",
password: process.env.SQ_PW,
Expand Down
Loading