Move Dockerfiles into one toplevel Dockerfile

This commit is contained in:
Hyunggyu Jang 2023-03-21 12:40:37 +09:00
parent 1041146fcb
commit c233cc0d5c
5 changed files with 56 additions and 66 deletions

View file

@ -1,50 +1,29 @@
version: "2"
version: "3.4"
services:
client:
image: react-client
build: ./client
restart: always
ports:
- "3080:80"
volumes:
- ./client:/client
- /client/node_modules
links:
- api
networks:
- webappnetwork
api:
image: node-api
build: ./api
restart: always
env_file:
- ./api/.env
environment:
- HOST=0.0.0.0
- NODE_ENV=production
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
ports:
- "9000:3080"
volumes:
- ./api:/api
- /api/node_modules
depends_on:
- mongodb
networks:
- webappnetwork
mongodb:
image: mongo
restart: always
container_name: mongodb
volumes:
- ./data-node:/data/db
ports:
- 27020:27017
command: mongod --noauth
networks:
- webappnetwork
networks:
webappnetwork:
driver: bridge
api:
ports:
- 3080:3080
depends_on:
- mongodb
image: node-api
build:
context: .
target: node-api
restart: always
env_file:
- ./api/.env
environment:
- HOST=0.0.0.0
- NODE_ENV=production
- MONGO_URI=mongodb://mongodb:27017/chatgpt-clone
volumes:
- ./api:/api
- /api/node_modules
mongodb:
image: mongo
restart: always
container_name: mongodb
volumes:
- ./data-node:/data/db
command: mongod --noauth