একটি Dockerfile হল একটি টেক্সট ফাইল যাতে Docker ইমেজ তৈরির জন্য নির্দেশনা রয়েছে — এটি বেস ইমেজ, ডিপেন্ডেন্সি, কপি করার জন্য ফাইল এবং অ্যাপ্লিকেশন কীভাবে চালাতে হয় তা বর্ণনা করে। এটি ইমেজ বিল্ড পুনরুৎপাদনযোগ্য এবং সংস্করণ-নিয়ন্ত্রণযোগ্য করে তোলে।
একটি মৌলিক Dockerfile
# FROM — the base image to build on
FROM node:20-alpine
# WORKDIR — set the working directory inside the image
WORKDIR /app
# COPY dependency files first (for better layer caching)
COPY package*.json ./
# RUN — execute a command during the BUILD (install dependencies)
RUN npm install
# COPY the rest of the application code
COPY . .
# EXPOSE — document the port the app listens on
EXPOSE 3000
# CMD — the command to run when a CONTAINER starts
CMD ["node", "server.js"]
