Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oceanBT/cf68f055c3f14203db59cf93af1adc2c to your computer and use it in GitHub Desktop.
Save oceanBT/cf68f055c3f14203db59cf93af1adc2c to your computer and use it in GitHub Desktop.
create react app with docker without local nodejs
mkdir -p ~/project
cd  ~/project
docker run -it --rm -v "$PWD":/app -w /app node  yarn create react-app my-app
sudo chown -R $USER:root my-app/
cd my-app
nano docker-compose.yml  # see docker-compose.yml below
docker compose up -d
### docker-compose.yml
services:
      node:
        image: node:16-alpine
        environment:
          - CHOKIDAR_USEPOLLING=true
          - FAST_REFRESH=true
        working_dir: /app
        ports:
          - '3000:3000'
        command: "yarn start"
        volumes:
          - './:/app'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment