Docker + Django + React environment construction

Dockerfile (for Django)

FROM python:3.9.0
ENV PYTHONUNBUFFERED 1
RUN mkdir /backend
WORKDIR /backend
ADD requirements.txt /backend/
RUN pip install -r requirements.txt
ADD . /backend/

Dockerfile-nodejs (for React)

FROM node:12.19.0
RUN mkdir /frontend
WORKDIR /frontend
RUN npm install -g create-react-app

requirements.txt

Django==3.1
psycopg2

docker-compose.yml

version: '3'

services:
  db:
    image: postgres
    environment: 
      POSTGRES_PASSWORD: password
  django:
    build: .
    command: python3 manage.py runserver 0.0.0.0:8000
    volumes:
      - ./backend:/backend
    ports:
      - "8000:8000"
    depends_on:
      - db
  
  react:
    build:
      context: .
      dockerfile: "./Dockerfile-nodejs"
    volumes:
      - .:/frontend
    command: >
        cd frontend && yarn start
    ports:
      - "3000:3000"

Recommended Posts

Docker + Django + React environment construction
Django environment construction
Environment construction: GCP + Docker
Django project environment construction
Django development environment construction memo
django project development environment construction
Django + Docker
Mac + Eclipse (PyDev) + Django environment construction
[Django] Memorandum of environment construction procedure
[For beginners] Django -Development environment construction-
[Linux] Docker environment construction on Redhat
Data science environment construction with Docker
[docker] python3.5 + numpy + matplotlib environment construction
DeepIE3D environment construction
Emacs-based environment construction
Linux environment construction
Environment construction (python)
CodeIgniter environment construction
python environment construction
Python --Environment construction
Python environment construction
Django + Docker command
Golang environment construction
python environment construction
Word2vec environment construction
Make Django's environment Docker (Docker + Django + Gunicorn + nginx) Part 2
Analytical environment construction with Docker (jupyter notebook + PostgreSQL)
[Python] Build a Django development environment with Docker
Create Nginx + uWSGI + Python (Django) environment with docker
Pillow environment construction --For Docker + iPython (and OpenCV)
[Django3] Environment construction and various settings summary [Python3]
From 0 to Django development environment construction to basic operation
Make Django's environment Docker (Docker + Django + Gunicorn + nginx) Part 3
python windows environment construction
Go language environment construction
ConoHa environment construction memo
homebrew python environment construction
PyData related environment construction
Anaconda-4.2.0-python3 environment construction (Mac)
Python development environment construction
YOLO v4 environment construction ①
pyenv + fish environment construction
python2.7 development environment construction
Python local development environment construction template [Flask / Django / Jupyter with Docker + VS Code]
BigGorilla environment construction memo
grip environment construction onCentOS6.5
Anaconda environment construction memo
Golang environment construction [goenv]
Mac environment construction Python
Docker under proxy environment
Pyxel environment construction (Mac)
[Memo] Django development environment
Python environment construction @ Win7
[Python] OpenCV environment construction with Docker (cv2.imshow () also works)
From Kafka to KSQL --Easy environment construction with docker
How to build a Django (python) environment on docker
Web application made with Python3.4 + Django (Part.1 Environment construction)
WSL2 environment construction example Python, Node.js, Java, git-secrets, Docker
Pepper-kun remote control environment construction with Docker + IPython Notebook
[Python] Django environment construction (pyenv + pyenv-virtualenv + Anaconda) for macOS
Build a development environment with Poetry Django Docker Pycharm