Skip to content

Conversation

@ggfevans
Copy link
Contributor

@ggfevans ggfevans commented Jan 20, 2026

Addresses #7

  • Replace deprecated npm ci --only=production with npm ci --omit=dev
  • Remove deprecated top-level version field from compose files
  • Remove redundant healthcheck definitions (Dockerfiles are source of truth)
  • Add missing LASTFM_API_KEY to docker-compose.dev.yml
  • Add security hardening: no-new-privileges and cap_drop ALL

Capabilities Explanation

We use cap_drop: ALL to remove all Linux capabilities, then add back only what's required:

Container Capabilities Reason
Backend SETUID, SETGID su-exec drops from root to nodejs user at runtime
Frontend CHOWN, SETUID, SETGID nginx entrypoint sets up cache directories and spawns workers

Why this is still a security win

Default Docker containers have ~14 capabilities. With this change:

Removed (no longer available to containers):

  • NET_RAW - Raw packet crafting
  • SYS_CHROOT - Chroot jail creation
  • MKNOD - Device node creation
  • AUDIT_WRITE - Kernel audit log writes
  • DAC_OVERRIDE - Bypass file permission checks
  • FOWNER - Bypass ownership checks
  • FSETID - Set file SUID/SGID bits
  • KILL - Send signals to any process
  • NET_BIND_SERVICE - Bind to privileged ports
  • SETFCAP - Set file capabilities
  • SETPCAP - Modify process capabilities

Retained (minimum required):

  • SETUID/SETGID - User switching (both containers)
  • CHOWN - Ownership changes (frontend only)

- Replace deprecated `npm ci --only=production` with `npm ci --omit=dev`
- Remove deprecated top-level `version` field from compose files
- Remove redundant healthcheck definitions (Dockerfiles are source of truth)
- Add missing LASTFM_API_KEY to docker-compose.dev.yml
- Add security hardening: no-new-privileges and cap_drop ALL

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@ggfevans
Copy link
Contributor Author

closing in lieu of #14 & #15

@ggfevans ggfevans closed this Jan 21, 2026
@ggfevans ggfevans deleted the docker-improvements branch January 21, 2026 04:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant