Skip to content

Instantly share code, notes, and snippets.

@prateekkathal
Created June 18, 2021 18:37
Show Gist options
  • Save prateekkathal/c60bcf2469217db1dac36b9f89e397b7 to your computer and use it in GitHub Desktop.
Save prateekkathal/c60bcf2469217db1dac36b9f89e397b7 to your computer and use it in GitHub Desktop.
For Medium Article - Using Docker with NestJS (or any NodeJS app)
version: "3.7"
services:
backend:
container_name: myapp_backend
restart: always
build: .
environment:
- APP_ENV=development
- APP_PORT=9000
volumes:
- ./src:/var/www/myapp/src
- ./test:/var/www/myapp/test
working_dir: /var/www/myapp
ports:
- "9001:9000"
links:
- mysql
- redis
depends_on:
- mysql
- redis
mysql: # Example Service
container_name: myapp_mysql
restart: always
image: mysql:5.7
environment:
- MYSQL_ROOT_PASSWORD=root
- MYSQL_USER=myapp
- MYSQL_PASSWORD=myapp
- MYSQL_DATABASE=myapp_docker
ports:
- "3308:3306"
volumes:
- myapp_mysql_data:/var/lib/mysql
redis: # Example Service
container_name: myapp_redis
restart: always
image: redis:6.0-alpine
expose:
- "6379"
volumes:
- myapp_redis_data:/data
volumes:
myapp_mysql_data:
myapp_redis_data:
networks:
default:
external:
name: myapp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment