tcuongtran / codepad

0 stars 0 forks source link

Docker compose #4

Open tcuongtran2 opened 2 weeks ago

tcuongtran2 commented 2 weeks ago
version: '3.8'

services:
  nodejs-app:
    build:
      context: ./nodejs
    container_name: container1
    ports:
      - "3000:3000" # Adjust the ports as needed
    environment:
      - NODE_ENV=production
    volumes:
      - ./nodejs:/app
    restart: unless-stopped

  flask-app:
    build:
      context: ./python
    container_name: container2
    ports:
      - "5000:5000" # Adjust the ports as needed
    environment:
      - FLASK_ENV=production
    volumes:
      - ./python:/app
    restart: unless-stopped
Chethan34 commented 2 weeks ago

Hey tcuongtran , assuming your file named as docker-compose.yml which is in root directory.

version: '3.8'

services:
  nodejs-app:
    build:
      context: ./nodejs
    container_name: container1
    ports:
      - "3000:3000" 
    environment:
      - NODE_ENV=production
    volumes:
      - ./nodejs:/app
    restart: unless-stopped

  flask-app:
    build:
      context: ./python
    container_name: container2
    ports:
      - "5000:5000" 
    environment:
      - FLASK_ENV=production
    volumes:
      - ./python:/app
    restart: unless-stopped

You may try this organised code above.