How to Create a Dockerfile using a Node.js backend and a React frontend

Опубликовано: 12 Март 2026
на канале: DEVOPS TRAINING BY PREETHI DOVALA
233
4

Dockerfile
Use an official Node.js runtime as the base image
FROM node:14-alpine

Set the working directory in the container
WORKDIR /app

Copy package.json and package-lock.json to the container
COPY package*.json ./

Install dependencies
RUN npm install

Copy the rest of the application code to the container
COPY . .

Build the React frontend
RUN npm run build

Expose port 3000 to the outside world
EXPOSE 3000

Command to run the application
CMD ["npm", "start"]

#dockertraining #dockertutorial #preethidevops