Install
npx skillscat add kbrdn1/dotfiles/docker-templates Install via the SkillsCat registry.
SKILL.md
Templates Docker
Dockerfile Node.js Optimisé
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
FROM node:20-alpine
WORKDIR /app
COPY --from=builder /app/node_modules ./node_modules
COPY . .
USER node
EXPOSE 3000
CMD ["node", "server.js"]Dockerfile Python
FROM python:3.12-slim AS builder
WORKDIR /app
COPY requirements.txt .
RUN pip install --user -r requirements.txt
FROM python:3.12-slim
WORKDIR /app
COPY --from=builder /root/.local /root/.local
COPY . .
ENV PATH=/root/.local/bin:$PATH
CMD ["python", "app.py"]Docker Compose Dev
services:
app:
build: .
volumes:
- .:/app
- /app/node_modules
ports:
- "3000:3000"
environment:
- NODE_ENV=developmentBest Practices
- Multi-stage builds pour images légères
- .dockerignore pour exclure node_modules, .git
- USER non-root en production
- HEALTHCHECK pour orchestration