Learning Docker: Creating a Dockerfile

  1. Build the right environment for our application to operate in
  2. Install our application
  3. Run the application
FROM node:latestRUN mkdir /basic-reactWORKDIR /basic-reactCOPY package.json .RUN npm installCOPY . .EXPOSE 8080CMD ["npm", "start"]

FROM node:latest

RUN mkdir /basic-react

WORKDIR /basic-react

COPY package.json .

RUN npm install

COPY . .

EXPOSE 8080

CMD [“npm”, “start”]

"scripts": {   "start": "npx webpack-dev-server --mode development --open --hot --host 0.0.0.0"}

Running a Container

docker build -t bbreact .
docker run -p 8080:8080/tcp bbreact:latest

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store