| name | devtools-docker-development-environment |
| description | Sub-skill of devtools: Docker Development Environment (+2). |
| version | 1.0.0 |
| category | development |
| type | reference |
| scripts_exempt | true |
Docker Development Environment (+2)
Docker Development Environment
cat > Dockerfile << 'EOF'
FROM node:20-alpine AS builder
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
FROM node:20-alpine AS production
WORKDIR /app
COPY --from=builder /app/dist ./dist
COPY --from=builder /app/node_modules ./node_modules
EXPOSE 3000
CMD ["node", "dist/server.js"]
EOF
cat > docker-compose.yml << 'EOF'
version: '3.8'
services:
app:
build:
context: .
target: builder
volumes:
- .:/app
- /app/node_modules
ports:
- "3000:3000"
environment:
- NODE_ENV=development
command: npm run dev
db:
image: postgres:15-alpine
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
POSTGRES_DB: devdb
POSTGRES_USER: devuser
POSTGRES_PASSWORD: devpass
redis:
image: redis:7-alpine
ports:
- "6379:6379"
volumes:
postgres_data:
EOF
docker compose up -d
docker compose logs -f app
docker compose exec app sh
docker compose down -v
CLI Productivity Setup
alias ll='ls -alF'
alias la='ls -A'
alias l='ls -CF'
alias ..='cd ..'
alias ...='cd ../..'
alias g='git'
alias d='docker'
alias dc='docker compose'
alias k='kubectl'
alias gs='git status'
alias ga='git add'
alias gc='git commit'
alias gp='git push'
alias gl='git log --oneline -20'
alias gd='git diff'
alias gb='git branch'
alias gco='git checkout'
export FZF_DEFAULT_COMMAND='fd --type f --hidden --exclude .git'
export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"
export FZF_ALT_C_COMMAND='fd --type d --hidden --exclude .git'
fe() {
local file=$(fzf --preview 'bat --color=always {}')
[[ -n "" ]] &&
}
() {
branch=$(git branch -a | fzf | sed | xargs)
[[ -n ]] && git checkout
}
() {
pid=$(ps aux | fzf | awk )
[[ -n ]] && -9
}
VS Code Configuration
{
"editor.fontSize": 14,
"editor.fontFamily": "'JetBrains Mono', 'Fira Code', monospace",
"editor.fontLigatures": true,
"editor.lineNumbers": "relative",
"editor.minimap.enabled": false,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"files.autoSave": "onFocusChange",
"files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true,
"terminal.integrated.fontSize": 13,
[
{ "key": "cmd+k cmd+e", "command": "workbench.view.explorer" },
{ "key": "cmd+k cmd+g", "command": "workbench.view.scm" },
{ "key": "cmd+k cmd+t", "command": "workbench.action.terminal.toggleTerminal" },
{ "key": "cmd+shift+d", "command": "editor.action.copyLinesDownAction" },
{ "key": "cmd+shift+k", "command": "editor.action.deleteLines" }
]