Docker Compose
API + Postgres
version: '3.8'
volumes:
postgres_data:
external: false
instances_volume:
external: false
networks:
public-network:
driver: bridge
# external: true
services:
# API Service
codechat_api:
container_name: codechat_v2
build:
context: .
dockerfile: <path of your Dockerfile>
image: codechat/apiv2
ports:
- 8083:8083
# environment:
# - DOCKER_ENV=true
# - NODE_ENV=PRODUCTION
# - DATABASE_URL=postgresql://USER:PASS@HOST/codechat_development?schema=public
env_file:
- ./.env
volumes:
- instances_volume:/codechat/instances
depends_on:
- postgres
- redis
networks:
- public-network
# PostgreSQL Database Service
postgres:
image: postgres:latest
container_name: postgres_server
environment:
- POSTGRES_USER=root
- POSTGRES_PASSWORD=password
ports:
- 5432:5432
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- public-network
redis:
image: redis:alpine
restart: always
command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
volumes:
- /data/redis:/data
ports:
- '127.0.0.1:6379:6379'
API + MariaDB
version: '3.8'
networks:
public-network:
driver: bridge
# external: true
volumes:
mysql_data:
external: false
instances_volume:
external: false
services:
# API Service
codechat_api:
container_name: codechat_api
build:
context: .
dockerfile: <path of your Dockerfile>
image: codechat_v2/api:latest
ports:
- 8083:8083
# environment:
# - DOCKER_ENV=true
# - NODE_ENV=PRODUCTION
# - DATABASE_URL=postgresql://USER:PASS@HOST/codechat_development?schema=public
env_file:
- ./.env
volumes:
- instances_volume:/codechat/instances
depends_on:
- mysqldb
- redis
networks:
- public-network
# MySQL Database Service
mysqldb:
container_name: mariadb_server
# container_name: mysql
restart: always
image: mariadb
# image: mysql
command: --default-authentication-plugin=mysql_native_password
environment:
MYSQL_ROOT_PASSWORD: password
ports:
- 3306:3306
volumes:
- mysql_data:/var/lib/mysql
networks:
- public-network
# PhpmyAdmin: MySQL or MariaDB Database Administration
phpmyadmin:
container_name: phpmyadmin
restart: always
image: phpmyadmin
environment:
- PMA_HOSTS=mysqldb
- PMA_HOST=host
- PMA_PORT=3306
- PMA_ARBITRARY=1
ports:
- 8080:80
networks:
- public-network
redis:
image: redis:alpine
restart: always
command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
volumes:
- /data/redis:/data
ports:
- '127.0.0.1:6379:6379'
API + MongoDB
version: '3.8'
networks:
public-network:
driver: bridge
# external: true
volumes:
mongo_data:
external: false
instances_volume:
external: false
services:
# API Service
codechat_api:
container_name: codechat_api
build:
context: .
dockerfile: <path of your Dockerfile>
image: codechat_v2/api:latest
ports:
- 8083:8083
# environment:
# - DOCKER_ENV=true
# - NODE_ENV=PRODUCTION
# - DATABASE_URL=postgresql://USER:PASS@HOST/codechat_development?schema=public
env_file:
- ./.env
volumes:
- instances_volume:/codechat/instances
depends_on:
- mongodb
- redis
networks:
- public-network
# MongoDb Database Service
mongodb:
container_name: nongodb_server
image: mongo:latest
container_name: mongodb_server
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: pass
environment:
MYSQL_ROOT_PASSWORD: password
ports:
- 27017:27017
volumes:
- mongo_data:/var/lib/db
networks:
- public-network
redis:
image: redis:alpine
restart: always
command: ["sh", "-c", "redis-server --requirepass \"$REDIS_PASSWORD\""]
volumes:
- /data/redis:/data
ports:
- '127.0.0.1:6379:6379'