React Development Environment using Docker

React Development Environment using Docker

React is the most popular frontend framework and it is used by milions if not 100’s of milions of the websites in the world.

However it can sometimes be a pain in the *** espacially when working with dependiencies or working with an old project that used an older version of node or npm that conflicts with your local node version.

In such a case that’s where Docker comes to your rescue .It helps to isolate a project to a very nice and easy to use environment for you to use for whaterver environment you are using.

Prerequisites

  • To get started you need to have Docker installed in your machine (will be creating a tutorial soon for all operating systems ) https://docs.docker.com/engine/install/
  • Node js Run Time Environment and Npm

Get Started

If you dont have a react project already created you can get started with the command below

npx  create vite@latest

Docker File

FROM node:14

# 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 --silent

# copy source code
COPY . .

https://medium.com/@sudiptob2/properly-setting-up-react-development-environment-using-docker-a2de46464d0b

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *