Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup docker #25

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

setup docker #25

wants to merge 1 commit into from

Conversation

yunchipang
Copy link
Owner

@yunchipang yunchipang commented Apr 10, 2024

⚠️ changes config. need to be merge lastly.

🎯 goal: to run 4 apps (redis, django backend and 2 react frontends) altogether to reduce complexity of setting up environments. for the purpose of demonstrating the real-time chat feature, two react frontends run on ports 3000 and 3001 respectively.

directory hierarchy:

.
├── backend-django
├── docker-compose.yml
├── frontend-react
├── README.md

docker-compose.yml

services:
  redis:
    container_name: redis
    image: "redis:alpine"
    ports:
      - "6379:6379"
  django:
    container_name: django
    build: ./backend-django
    command: python manage.py runserver 0.0.0.0:8000
    volumes:
      - ./backend-django:/app
    ports:
      - "8000:8000"
    env_file:
      - ./backend-django/.env
    depends_on:
      - redis
  react1:
    container_name: react1
    build: ./frontend-react
    volumes:
      - ./frontend-react:/app
      - /app/node_modules
    ports:
      - "3000:80"
    depends_on:
      - django
  react2:
    container_name: react2
    build: ./frontend-react
    volumes:
      - ./frontend-react:/app
      - /app/node_modules
    ports:
      - "3001:80"
    depends_on:
      - django

to run the bundled app:

❯ docker-compose up --build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant