Contributing Guide
Thank you for your interest in this project! We welcome all kinds of contributions, including but not limited to:
- Bug reports
- Feature requests
- Pull requests
- Documentation improvements
How to contribute
1. Fork the repository
Fork the repository to your own GitHub account.
2. Create a branch
Create a new feature branch from main:
Branch name conventions:
feat/— new featurefix/— bug fixdocs/— documentation updaterefactor/— code refactoringtest/— testing-related changes
3. Make your changes
Dockerfile style guide
- Instruction case — use uppercase for all Dockerfile instructions (
FROM,RUN,COPY, etc.). - Comments — add comments for each major step explaining its purpose.
- Layer optimization — combine related
RUNinstructions to reduce image layers. - Security:
- Avoid hardcoding secrets in images.
- Run applications as a non-root user (
ma-userfor ModelArts images). - Keep base images and dependencies up to date.
- Maintainability:
- Keep code clear and readable.
- Use meaningful variable names.
- Follow the existing style in the repository.
Pre-commit checks
Before submitting, please make sure:
- Run Hadolint to lint Dockerfiles:
# Install hadolint if you have not already
# macOS: brew install hadolint
# Linux: download from https://github.com/hadolint/hadolint/releases
# Lint all Dockerfiles
find . -name "Dockerfile*" -exec hadolint {} +
- Validate syntax with Docker:
- Update documentation if you add or change a Dockerfile.
4. Commit your changes
Write clear, descriptive commit messages:
Commit message prefixes:
feat:— new featurefix:— bug fixdocs:— documentation updatestyle:— formatting changes that do not affect functionalityrefactor:— code refactoringtest:— testing-related changeschore:— build process or tooling changes
5. Push and open a Pull Request
Then open a Pull Request on GitHub and include:
- The purpose and background of the change
- A summary of major changes
- References to any related issues
- Testing notes, if applicable
All Pull Requests are reviewed for:
- Code quality and style
- Dockerfile best practices
- Documentation completeness
- Test coverage, if applicable
Please be patient and address any feedback you receive.
Dockerfile best practices
Base images
- Prefer official, maintained base images.
- Pin explicit version tags; avoid
latest. - Choose an appropriate base image size for your use case.
Layer caching
# Good: place slow-changing steps early
RUN apt-get update && apt-get install -y package1 package2
# Bad: place frequently changing steps before slow package installs
COPY frequently-changing-file.txt /app/
RUN apt-get update && apt-get install -y package1
Reducing image size
- Use
--no-cachewhen installing packages where appropriate. - Clean package caches (
apt,yum,dnf) in the sameRUNlayer. - Remove temporary files and build dependencies.
- Use multi-stage builds when they help.
Security
# Good: run as a non-root user
USER ma-user
WORKDIR /home/ma-user
# Avoid: storing secrets in the image
# ENV API_KEY=secret-key # do not do this
Environment variables
- Use
ENVfor environment variables. - Provide sensible defaults where appropriate.
- Avoid hardcoding paths and configuration values.
Reporting issues
If you find a problem, please open an issue and include:
- Description — a clear description of the problem
- Steps to reproduce — how to trigger the issue
- Expected behavior — what you expected to happen
- Actual behavior — what actually happened
- Environment:
- Docker version
- Operating system
- Relevant Dockerfile path
- Logs — any relevant error logs or output
Feature requests
If you have a feature idea, please open an issue and describe:
- Feature description — what you would like to see
- Use case — when and why you would use it
- Possible implementation — any ideas you have for how to implement it
License
By contributing code, you agree that your contribution will be released under the same license as this project: the MIT License.
Contact
If you have any questions, please:
- Open an issue
- Open a Pull Request and mention your question in the description
Thank you for contributing!