Skip to content

fix(docker): harden Dockerfile — pipefail, no curl|bash, healthcheck, .dockerignore#8

Open
Guimove wants to merge 2 commits into
mainfrom
fix/dockerfile-security-hardening
Open

fix(docker): harden Dockerfile — pipefail, no curl|bash, healthcheck, .dockerignore#8
Guimove wants to merge 2 commits into
mainfrom
fix/dockerfile-security-hardening

Conversation

@Guimove
Copy link
Copy Markdown

@Guimove Guimove commented May 26, 2026

Summary

Fixes all errors and warnings reported by the Dockerfile linter (droast). Build tested locally ✅

droast score

Before After
Errors 9 2 (USER root × 2, intentional)
Warnings 8 0 ✅
Infos 7 2 (npm global install + unpinned apt)

Changes

Rule Fix
DF057 — no pipefail SHELL ["/bin/bash", "-o", "pipefail", "-c"] applied globally
DF021curl | bash (×4) Download script to /tmp first, execute, delete — NodeSource, Qovery CLI, RTK, Qovery Skills
DF035curl without --fail curl -fsSL on Qovery CLI install
DF021/DF057echo | sha256sum false positives Replaced pipe with checksum file (sha256sum -c file) in GitHub CLI, Zellij, ttyd blocks
DF008cd in RUN (×2) Absolute /tmp/ paths in GitHub CLI and Zellij blocks
DF004 — apt cache not cleaned apt-get clean + rm -rf /var/lib/apt/lists/* as last commands in apt block; removed inline comments that confused the linter
DF058 — wget + curl both installed Removed wget (curl is used everywhere)
DF060htop in container Removed
DF053 — unpinned gem gem install bundler:2.5.23
DF012 — no HEALTHCHECK HEALTHCHECK curl against port 8080, 60s start period
DF033 — no .dockerignore Created — excludes .git, node_modules, secrets, logs, CI configs

Not changed (intentional)

  • DF002 USER root ×2 — both are load-bearing: (1) system package installation, (2) entrypoint needs root to chown volume-mounted /home/coder before dropping to the coder user.
  • DF005 unpinned apt packages — pinning ~10 dev tools creates maintenance overhead with no practical security gain in a dev workspace image.
  • DF031 npm install -gnpm ci cannot install global packages; linter false positive.

Guimove and others added 2 commits May 25, 2026 20:56
… dockerignore

- Add SHELL [/bin/bash -o pipefail -c] globally so pipe failures are not silently ignored (DF057)
- Download remote install scripts to /tmp before executing instead of piping curl directly into bash/sh (DF021): NodeSource setup, Qovery CLI, RTK, Qovery Skills
- Replace curl -s with curl -fsSL on Qovery CLI install so HTTP errors fail the build (DF035)
- Remove cd in RUN for GitHub CLI and Zellij blocks — use absolute /tmp paths instead (DF008)
- Add apt-get clean before rm -rf /var/lib/apt/lists/* (DF004)
- Add HEALTHCHECK against port 8080 with 60s start period (DF012)
- Add .dockerignore to exclude .git, node_modules, secrets, logs, CI configs from build context (DF033)

USER root is kept in two intentional places with comments:
1. System package installation (required)
2. Entrypoint privilege drop — root needed to fix volume ownership, entrypoint drops to coder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…6 via file, rm wget/htop, pin bundler

- Move apt-get clean + rm /var/lib/apt/lists/* after gem install so linter parses cleanup correctly (DF004)
- Remove inline comments from apt-get install block that were confusing the linter
- Replace echo|sha256sum pipes with checksum file (sha256sum -c file) to avoid false-positive DF021/DF057 on verification blocks
- Remove wget (curl is already installed, no need for both) — fixes DF058
- Remove htop (no interactive monitoring in containers) — fixes DF060
- Pin bundler to version 2.5.23 — fixes DF053

Remaining: 2x DF002 USER root (intentional — system install + entrypoint volume chown before su coder)
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