Skip to content

Conversation

rberrelleza
Copy link
Member

Summary

This PR fixes casing warnings in the Dockerfile and adds comprehensive automated validation to ensure the Dockerfile always builds successfully.

Changes Made

🐛 Bug Fixes

  • Fixed Dockerfile casing warning: Changed chmod +x notify-pr.sh to chmod +x /notify-pr.sh to use the correct absolute path where the file was copied
  • Removed trailing whitespace from the ENTRYPOINT instruction

✨ New Features

  • GitHub Action for Dockerfile validation: Added .github/workflows/dockerfile-validation.yml that runs on every push/PR affecting the Dockerfile
  • Local validation script: Added validate-dockerfile.sh for testing the Dockerfile locally before pushing
  • Dockerfile linting: Integrated hadolint for comprehensive Dockerfile best practices validation
  • Comprehensive testing: The validation includes:
    • Dockerfile linting with hadolint
    • Building the Docker image
    • Testing container execution
    • Verifying required binaries are present
    • Checking entrypoint executability

📚 Documentation

  • Updated README: Added development section explaining the validation process
  • Hadolint configuration: Added .hadolint.yaml with appropriate rules for this project

Testing

The GitHub Action will automatically validate:

  • ✅ Dockerfile builds successfully
  • ✅ Container runs without errors
  • ✅ All required binaries (okteto, jq, ruby) are present
  • ✅ Entrypoint is executable
  • ✅ Dockerfile follows best practices

Local Testing

Developers can now run ./validate-dockerfile.sh to test changes locally before pushing.


This PR was co-created with Okteto AI Agent Fleets 🤖

- Fixed chmod command to use absolute path /notify-pr.sh instead of relative path
- Added comprehensive GitHub Action workflow to validate Dockerfile builds
- Includes Dockerfile linting with hadolint
- Tests image build and basic functionality
- Added validate-dockerfile.sh script for local testing
- Updated README with development section explaining validation process
- Provides both automated CI validation and local testing capabilities
- Added .hadolint.yaml configuration for Dockerfile linting
- Fixed trailing whitespace in ENTRYPOINT instruction
- Configured trusted registries and rule overrides for better linting
- Added WORKDIR /app before COPY commands to fix DL3045 warnings
- Pinned gem versions (octokit:9.2.0, faraday-retry:2.2.1) to fix DL3028 warning
- Updated hadolint configuration to remove fixed warnings
- Updated octokit to v10.0.0
- Updated faraday-retry to v2.3.2
Copy link
Member Author

@rberrelleza rberrelleza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added suggestion

Co-authored-by: Ignacio Fuertes <nacho@okteto.com>
Copy link
Member

@ifbyol ifbyol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rberrelleza Feel free to merge it whenever is ready

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.

3 participants