Dockerfile(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(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"