Fix dockerlint - #8523
Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to fix the Docker lint (hadolint) CI workflow and normalize mixed line endings across various markdown/docs and small scripts in the repository.
Changes:
- Normalizes line endings/formatting in QA plans and documentation markdown files.
- Updates multiple container Dockerfiles to satisfy hadolint expectations (e.g.,
SHELL ... pipefail,USER user:group, JSON-arrayHEALTHCHECKforms). - Adjusts the GitHub Actions Docker lint workflow logic.
Reviewed changes
Copilot reviewed 20 out of 46 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/QA/readme.md | Line ending / formatting normalization. |
| tests/QA/assets/backup-archive/readme.md | Line ending / formatting normalization. |
| tests/QA/080-daily-backup-script.md | Line ending / formatting normalization. |
| tests/QA/070-timezone-change.md | Line ending / formatting normalization. |
| tests/QA/060-environmental-variables.md | Line ending / formatting normalization. |
| tests/QA/050-optional-addons.md | Line ending / formatting normalization. |
| tests/QA/040-login-behavior.md | Line ending / formatting normalization. |
| tests/QA/030-aio-password-change.md | Line ending / formatting normalization. |
| tests/QA/020-backup-and-restore.md | Line ending / formatting normalization. |
| tests/QA/010-restore-instance.md | Line ending / formatting normalization. |
| tests/QA/004-initial-backup.md | Line ending / formatting normalization. |
| tests/QA/003-automatic-login.md | Line ending / formatting normalization. |
| tests/QA/002-new-instance.md | Line ending / formatting normalization. |
| tests/QA/001-initial-setup.md | Line ending / formatting normalization. |
| php/src/Cron/UpdateMastercontainer.php | Line ending / formatting normalization. |
| php/src/Cron/StopContainers.php | Line ending / formatting normalization (includes a misleading comment). |
| php/src/Cron/StartContainers.php | Line ending / formatting normalization. |
| php/src/Cron/StartAndUpdateContainers.php | Line ending / formatting normalization. |
| php/src/Cron/CreateBackup.php | Line ending / formatting normalization. |
| php/src/Cron/CheckBackup.php | Line ending / formatting normalization. |
| php/public/second-tab-warning.js | Line ending / formatting normalization. |
| manual-install/readme.md | Line ending / formatting normalization. |
| Containers/whiteboard/Dockerfile | Adjusts USER and HEALTHCHECK to be more lint-friendly. |
| Containers/watchtower/Dockerfile | Adjusts USER to user:group form. |
| Containers/talk/Dockerfile | Adds SHELL ... pipefail, changes USER, and switches to JSON-array HEALTHCHECK. |
| Containers/talk-recording/Dockerfile | Adds SHELL ... pipefail, changes USER, and switches to JSON-array HEALTHCHECK. |
| Containers/redis/Dockerfile | Adds SHELL ... pipefail, changes USER, and switches to JSON-array HEALTHCHECK. |
| Containers/postgresql/Dockerfile | Adds SHELL ... pipefail, changes USER, and switches to JSON-array HEALTHCHECK. |
| Containers/onlyoffice/Dockerfile | Switches to JSON-array HEALTHCHECK. |
| Containers/notify-push/Dockerfile | Adds SHELL ... pipefail, changes USER, adjusts user/group handling, and switches to JSON-array HEALTHCHECK. |
| Containers/nextcloud/Dockerfile | Adds SHELL ... pipefail, adjusts USER, and switches to JSON-array HEALTHCHECK. |
| Containers/nextcloud/config/swift.config.php | Line ending / formatting normalization. |
| Containers/nextcloud/config/s3.config.php | Line ending / formatting normalization. |
| Containers/mastercontainer/Dockerfile | Adds SHELL ... pipefail, adjusts USER, and switches to JSON-array HEALTHCHECK. |
| Containers/imaginary/Dockerfile | Changes USER and switches to JSON-array HEALTHCHECK (plus formatting). |
| Containers/fulltextsearch/Dockerfile | Adjusts USER and switches to JSON-array HEALTHCHECK. |
| Containers/eurooffice/Dockerfile | Switches to JSON-array HEALTHCHECK. |
| Containers/domaincheck/Dockerfile | Uses USER user:group and converts HEALTHCHECK to exec form with /bin/sh -c. |
| Containers/docker-socket-proxy/Dockerfile | Adjusts USER and switches to JSON-array HEALTHCHECK. |
| Containers/collabora/Dockerfile | Adjusts USER and switches to JSON-array HEALTHCHECK. |
| Containers/clamav/Dockerfile | Changes USER and switches to JSON-array HEALTHCHECK. |
| Containers/borgbackup/Dockerfile | Adjusts USER to user:group form. |
| Containers/apache/supervisord.conf | Line ending / formatting normalization. |
| Containers/apache/Dockerfile | Adds SHELL ... pipefail, changes USER, and switches to JSON-array HEALTHCHECK. |
| .github/workflows/update-yaml.yml | Line ending / formatting normalization. |
| .github/workflows/docker-lint.yml | Updates Dockerfile discovery and hadolint invocation logic. |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /** @var \AIO\Controller\DockerController $dockerController */ | ||
| $dockerController = $container->get(\AIO\Controller\DockerController::class); | ||
|
|
||
| // Start apache |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 46 changed files in this pull request and generated no new comments.
Suppressed comments (1)
Containers/clamav/Dockerfile:40
- The image now switches to
USER clamav:clamav, but the earlier ownership setup still hard-codes numeric IDs (chown -R 100:100 /var/lib/clamav). This reintroduces an implicit assumption about the upstream UID/GID mapping and can lead to permission issues if the packagedclamavuser/group IDs ever differ. Consider aligning ownership with the named user/group (as done elsewhere, e.g.Containers/talk-recording/Dockerfile:49).
USER clamav:clamav
RUN set -ex; \
freshclam --foreground --stdout
|
Hey, thanks a lot for the PR! I'll have a look soon! :) |
|
@Zoey2936 thanks a lot for the PR! Can you please split the change of line endings into a different PR so that we can focus with this one on fixing the dockerlint? Thanks in advance! :) |
ccdac8d to
bc7e850
Compare
|
Please rebase this branch |
|
done |
|
Please rebase instead of merging in this case |
89ebee2 to
d0619ea
Compare
|
done |
Signed-off-by: Zoey <zoey@z0ey.de>
d0619ea to
8bf6193
Compare
pabzm
left a comment
There was a problem hiding this comment.
Thank you for the PR! I've got a few questions and one request for a comment.
| # DL4006 warning: Set the SHELL option -o pipefail before RUN with a pipe in it. If you are using /bin/sh in an alpine image or if your shell is symlinked to busybox then consider explicitly setting your SHELL to /bin/ash, or disable this check | ||
| hadolint "$file" --ignore DL3018 --ignore DL4006 | tee -a ./hadolint.log | ||
| # DL3041 warning: Specify version with `dnf install -y <package>-<version>`. | ||
| # DL3066 info: Non-numeric user-id may not be resolvable by host system |
There was a problem hiding this comment.
Do we still need this, despite the user-IDs being replaced by usernames in this same PR?
There was a problem hiding this comment.
yes since the dockerlint rules wants to use the id numbers instead of usernames, but I think using IDs will break faster then usernames
| if grep -q "DL[0-9]\+\|SC[0-9]\+" ./hadolint.log; then | ||
| if [ -s hadolint.log ]; then |
There was a problem hiding this comment.
This isn't quite the same. Any output of executing hadolint (even coming from the shell, not even hadolint itself) would now abort the further execution of the script.
Can you explain why you changed this?
There was a problem hiding this comment.
because hadolint only prints to console if it finds issues and output/no-outpout is easier to detect than reading the file for a regex which could break easier
|
|
||
| VOLUME /mnt/data | ||
|
|
||
| SHELL ["/bin/ash", "-o", "pipefail", "-c"] |
There was a problem hiding this comment.
Why ash instead of the default sh?
There was a problem hiding this comment.
|
|
||
| # AIO settings start # Do not remove or change this line! | ||
| ENV NEXTCLOUD_VERSION=33.0.7 | ||
| # hadolint ignore=DL3064 |
There was a problem hiding this comment.
Please add a comment what this is required for.
There was a problem hiding this comment.
https://github.com/hadolint/hadolint/wiki/DL3064 I'm cutrently on mobile, can you please create a suggestion?
Summary
3. to review, feature component)AI (if applicable)