Skip to content

Commit

Permalink
Merge pull request #428 from crazy-max/buildx-fix-convert-warnings
Browse files Browse the repository at this point in the history
buildx: use Buffer for base64 encoding of the Dockerfile
  • Loading branch information
crazy-max authored Aug 7, 2024
2 parents 7c54753 + e979592 commit ded2f55
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions __tests__/.fixtures/lint.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
frOM busybox as base

Check warning on line 17 in __tests__/.fixtures/lint.Dockerfile

View workflow job for this annotation

GitHub Actions / test-itg (buildx/buildx.test.itg.ts, ubuntu-latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'frOM' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/
cOpy lint.Dockerfile .

Check warning on line 18 in __tests__/.fixtures/lint.Dockerfile

View workflow job for this annotation

GitHub Actions / test-itg (buildx/buildx.test.itg.ts, ubuntu-latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'cOpy' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/

# some special chars: distroless/python3-debian12のPythonは3.11
# https://github.com/docker/build-push-action/issues/1204#issuecomment-2274056016

from scratch

Check warning on line 23 in __tests__/.fixtures/lint.Dockerfile

View workflow job for this annotation

GitHub Actions / test-itg (buildx/buildx.test.itg.ts, ubuntu-latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'from' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/
MAINTAINER [email protected]

Check warning on line 24 in __tests__/.fixtures/lint.Dockerfile

View workflow job for this annotation

GitHub Actions / test-itg (buildx/buildx.test.itg.ts, ubuntu-latest)

The MAINTAINER instruction is deprecated, use a label instead to define an image author

MaintainerDeprecated: Maintainer instruction is deprecated in favor of using label More info: https://docs.docker.com/go/dockerfile/rule/maintainer-deprecated/
COPy --from=base \

Check warning on line 25 in __tests__/.fixtures/lint.Dockerfile

View workflow job for this annotation

GitHub Actions / test-itg (buildx/buildx.test.itg.ts, ubuntu-latest)

All commands within the Dockerfile should use the same casing (either upper or lower)

ConsistentInstructionCasing: Command 'COPy' should match the case of the command majority (uppercase) More info: https://docs.docker.com/go/dockerfile/rule/consistent-instruction-casing/
Expand Down
2 changes: 1 addition & 1 deletion src/buildx/buildx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ export class Buildx {
if (Util.isPathRelativeTo(workspaceDir, ls.DockerfilePath)) {
dockerfiles.push({
path: path.relative(workspaceDir, ls.DockerfilePath),
content: btoa(fs.readFileSync(ls.DockerfilePath, {encoding: 'utf-8'}))
content: Buffer.from(fs.readFileSync(ls.DockerfilePath, {encoding: 'utf-8'}), 'utf-8').toString('base64')
});
} else {
core.debug(`Buildx.convertWarningsToGitHubAnnotations: skipping Dockerfile outside of workspace: ${ls.DockerfilePath}`);
Expand Down

0 comments on commit ded2f55

Please sign in to comment.