/docker-react-admin

Docker React-Admin

Primary LanguageJavaScript

Docker React-Admin

npx create-react-app docker-react-admin

Dockerfile

# pull official base image
FROM node:14.16.0-alpine

# set working directory
WORKDIR /app

# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH

# install app dependencies
COPY package.json ./
COPY package-lock.json ./
RUN npm install

# add app
COPY . ./

# start app
CMD ["npm", "start"]

.dockerignore

node_modules
npm-debug.log
build
.dockerignore
**/.git
**/.DS_Store
**/node_modules
docker build -t react-admin:dev .

docker-compose.yml

version: '3.7'

services:

  react-admin:
    container_name: react-admin
    build:
      context: .
      dockerfile: Dockerfile
    volumes:
      - '.:/app'
      - '/app/node_modules'
    ports:
      - 3001:3000
    environment:
      - CHOKIDAR_USEPOLLING=true  
    stdin_open: true
docker-compose up -d --build
docker exec -it <container> sh
npm i react-admin ra-data-json-server prop-types
npm r react-admin ra-data-json-server prop-types