[PR #5527] fix: apply best practices for the latest buildkit #24964

Closed
opened 2026-02-21 20:24:01 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/5527

State: closed
Merged: Yes


Description

This PR fixes the lines in Dockerfile that does not follow the best practices.

The current Dockerfiles result following warnings due to newly introduced validation in BuildKit 0.14.0:

# build api with buildkit 0.14.1
$ docker buildx build --load .
...
 11 warnings found (use --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 2)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 17)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 30)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 31)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 32)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 33)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 34)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 35)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 36)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 41)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 64)
...

# build web with buildkit 0.14.1
$ docker buildx build --load .
...
 11 warnings found (use --debug to expand):
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 12)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 25)
 - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 34)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 36)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 37)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 38)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 39)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 40)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 41)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44)
 - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 62)

This also happened in the GHA:

We should follow:

Fixes #5512

Type of Change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • After applying this PR, ensure the command docker buildx build --load . does not show any warnings
  • After applying this PR, ensure the BuildKit 0.13.2, which is prior to 0.14.0, can be used to build without problems, means no side effects.

Suggested Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods
  • optional I have made corresponding changes to the documentation
  • optional I have added tests that prove my fix is effective or that my feature works
  • optional New and existing unit tests pass locally with my changes
**Original Pull Request:** https://github.com/langgenius/dify/pull/5527 **State:** closed **Merged:** Yes --- # Description This PR fixes the lines in Dockerfile that does not follow the best practices. The current Dockerfiles result following warnings due to newly introduced validation in BuildKit 0.14.0: ```bash # build api with buildkit 0.14.1 $ docker buildx build --load . ... 11 warnings found (use --debug to expand): - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 2) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 17) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 30) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 31) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 32) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 33) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 34) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 35) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 36) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 41) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 64) ... # build web with buildkit 0.14.1 $ docker buildx build --load . ... 11 warnings found (use --debug to expand): - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 12) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 25) - FromAsCasing: 'as' and 'FROM' keywords' casing do not match (line 34) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 36) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 37) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 38) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 39) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 40) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 41) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 44) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 62) ``` This also happened in the GHA: - https://github.com/langgenius/dify/actions/runs/9626335852/job/26552194930#step:7:415 - https://github.com/langgenius/dify/actions/runs/9626335852/job/26552194791#step:7:500 We should follow: - https://docs.docker.com/reference/build-checks/from-as-casing/ - https://docs.docker.com/reference/build-checks/legacy-key-value-format/ Fixes #5512 ## Type of Change Please delete options that are not relevant. - [x] Bug fix (non-breaking change which fixes an issue) # How Has This Been Tested? Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration - [x] After applying this PR, ensure the command `docker buildx build --load .` does not show any warnings - [x] After applying this PR, ensure the BuildKit 0.13.2, which is prior to 0.14.0, can be used to build without problems, means no side effects. # Suggested Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [x] My changes generate no new warnings - [ ] I ran `dev/reformat`(backend) and `cd web && npx lint-staged`(frontend) to appease the lint gods - [ ] `optional` I have made corresponding changes to the documentation - [ ] `optional` I have added tests that prove my fix is effective or that my feature works - [ ] `optional` New and existing unit tests pass locally with my changes
yindo added the pull-request label 2026-02-21 20:24:01 -05:00
yindo closed this issue 2026-02-21 20:24:01 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#24964