Sobes.tech
Middle

What is the purpose of a Dockerfile?

sobes.tech AI

Answer from AI

A Dockerfile is a text file containing a set of instructions for automatically creating a Docker image. It describes how to build the image: which base to use, which files to copy, which commands to run, which ports to open, etc.

Using a Dockerfile allows standardizing and automating the container build process, which simplifies application deployment and ensures environment reproducibility.

An example of a simple Dockerfile for a Node.js application:

FROM node:18
WORKDIR /app
COPY package.json ./
RUN npm install
COPY . .
CMD ["node", "index.js"]
EXPOSE 3000