DEV Community

Domingos Manuel Capitango
Domingos Manuel Capitango

Posted on

Docker connect with ReactJs Application

  1. sudo docker build -t aliendev66: frontend-invite.
  2. sudo docker run -p 3000: 3000 -d aliendev66: frontend-invite
  3. sudo docker ps

If you happen to restart your PC, run sudo docker start and the name of the image
To see all the created containers is: sudo docker ps -a

Dockerfile

Source Image

FROM node: 13-alpine

Working directory (this is where the application will be inside the container).

WORKDIR / usr / app

COPY package * .json ./

Adding / app / node_modules / .bin to $ PATH

ENV PATH node_modules / .bin: $ PATH

Installing application dependencies and caching.

COPY package.json package.json

RUN yarn add --silent

COPY. .

EXPOSE 3000

RUN yarn add react-scripts -g --silent

start app

CMD ["yarn", "start"]

Top comments (0)