# ✅ GOOD: Minimal exposure FROM node:18-alpine EXPOSE 3000 # Only what's necessary
Only expose ports that are absolutely necessary for the application's service.
COPY . .
COPY package*.json ./ RUN npm install
Treat EXPOSE as a contract. It tells other developers and orchestration tools (like Kubernetes) exactly where to look for your service.
# Different network scenarios FROM nginx:alpine
# ✅ GOOD: Minimal exposure FROM node:18-alpine EXPOSE 3000 # Only what's necessary
Only expose ports that are absolutely necessary for the application's service. dockerfile expose example
COPY . .
COPY package*.json ./ RUN npm install
Treat EXPOSE as a contract. It tells other developers and orchestration tools (like Kubernetes) exactly where to look for your service. # ✅ GOOD: Minimal exposure FROM node:18-alpine EXPOSE
# Different network scenarios FROM nginx:alpine dockerfile expose example