Set up development environments with Docker including hot reload, dev containers, bind mounts, and database containers.
Use this skill when:
.env files for local dev, never commit secrets..devcontainer/devcontainer.json for a full IDE-in-container experience.User: Set up a Node.js dev environment with hot reload and Postgres.
Agent: Here's a multi-stage Dockerfile with a dev target:
# Dockerfile
FROM node:20-alpine AS base
WORKDIR /app
COPY package.json package-lock.json ./
FROM base AS dev
RUN npm install
COPY . .
CMD ["npm", "run", "dev"]
FROM base AS prod
RUN npm ci --omit=dev
COPY . .
RUN npm run build
USER node
CMD ["node", "dist/index.js"]
And a Compose file for the full dev stack:
# docker-compose.yml