move to docker-compose + add db

This commit is contained in:
Kishan Takoordyal 2021-02-12 09:55:13 +04:00
parent 16f91dc886
commit fbe9dceb89
No known key found for this signature in database
GPG Key ID: 304DF64F0804D6A1
7 changed files with 75 additions and 5 deletions

14
.env Normal file
View File

@ -0,0 +1,14 @@
PROJECT_NAME=kinesis-docker
HTTP_PORT=8080
HTTPS_PORT=8443
REACT_PORT=3000
API_PORT=20000
WS_PORT=21000
CODE_SERVER_PORT=9000
MISC_PORT=13000
DB_PORT=30000

View File

@ -43,10 +43,13 @@ RUN deno upgrade && \
deno --version && \
deno run https://deno.land/std/examples/welcome.ts
# Install code-server
RUN curl -fsSL https://code-server.dev/install.sh | sh
EXPOSE 80/tcp
EXPOSE 443/tcp
EXPOSE 8080/tcp
EXPOSE 3000/tcp
EXPOSE 20000/tcp
EXPOSE 21000/tcp
EXPOSE 3306/tcp
EXPOSE 9000/tcp
EXPOSE 8080/tcp

4
config/code-server.yml Normal file
View File

@ -0,0 +1,4 @@
bind-addr: 127.0.0.1:9000
auth: password
password: a5d14b610c4d585e24fe9414
cert: false

12
config/init-mongo.js Normal file
View File

@ -0,0 +1,12 @@
db.createUser(
{
user: "user",
pwd: "password",
roles: [
{
role: "readWrite",
db : "db"
}
]
}
)

34
docker-compose.yml Normal file
View File

@ -0,0 +1,34 @@
version: "3.8"
services:
app:
build:
context: "./bin/app"
container_name: '${PROJECT_NAME}-app'
restart: 'always'
ports:
- "${HTTP_PORT}:80"
- "${HTTPS_PORT}:443"
- "${REACT_PORT}:3000"
- "${API_PORT}:20000"
- "${WS_PORT}:21000"
- "${CODE_SERVER_PORT}:9000"
- "${MISC_PORT}:8080"
links:
- db
volumes:
- ${CODE_SERVER_CONFIG-./config/code-server.yml}:/root/.config/code-server/config.yaml
db:
image: 'mongo'
container_name: '${PROJECT_NAME}-db'
restart: 'always'
environment:
- MONGO_INITDB_DATABASE=db
- MONGO_INITDB_ROOT_USERNAME=root
- MONGO_INITDB_ROOT_PASSWORD=toor
volumes:
- ${MONGO_CONFIG-./config/init-mongo.js}:/docker-entrypoint-initdb.d/init-mongo.js:ro
- ${MONGO_VOLUME-./mongo-volume}:/data/db
ports:
- ${DB_PORT}:27017

0
mongo-volume/.gitkeep Normal file
View File

View File

@ -1,4 +1,7 @@
#!/bin/bash
#!/bin/sh
docker build -t kinesis-debian .
docker run -d --tty --name kinesis-debian kinesis-debian
curl -L "https://github.com/docker/compose/releases/download/1.28.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose up -d