Skip to content

Latest commit

 

History

History
173 lines (123 loc) · 3.45 KB

File metadata and controls

173 lines (123 loc) · 3.45 KB

Contributing to phpbu-docker

Thank you for your interest in contributing to phpbu-docker!

Development Setup

Prerequisites

  • Docker with Buildx support
  • Git

Local Development

  1. Clone the repository:

    git clone https://github.com/netresearch/phpbu-docker.git
    cd phpbu-docker
  2. Build locally:

    docker buildx bake dev
  3. Test your changes:

    docker run --rm phpbu:dev --version
    docker run --rm phpbu:dev --help

Using Docker Compose

# Build and run
docker compose build phpbu
docker compose run --rm phpbu --version

# Development mode
docker compose up dev

Making Changes

Branch Naming

  • feature/ - New features
  • fix/ - Bug fixes
  • docs/ - Documentation updates
  • security/ - Security improvements

Commit Messages

Follow Conventional Commits:

type(scope): description

[optional body]

[optional footer]

Types: feat, fix, docs, style, refactor, test, chore

Examples:

feat(dockerfile): add arm64 support
fix(security): run as non-root user
docs(readme): update usage examples

Pull Request Process

flowchart LR
    A[Fork] --> B[Branch]
    B --> C[Develop]
    C --> D[Test]
    D --> E[Lint]
    E --> F[PR]
    F --> G{Review}
    G -->|Approved| H[Merge]
    G -->|Changes| C
Loading
  1. Fork the repository
  2. Create a feature branch from main
  3. Make your changes
  4. Test locally with docker buildx bake ci
  5. Lint with hadolint: docker run --rm -i hadolint/hadolint < Dockerfile
  6. Submit a pull request

PR Requirements

  • Dockerfile passes hadolint
  • docker buildx bake --print validates bake file
  • Image builds successfully
  • --version and --help work
  • No new critical/high vulnerabilities (Trivy)
  • Documentation updated if needed

Testing

Build Validation

# Validate bake configuration
docker buildx bake --print

# Build minimal variant (CI target)
docker buildx bake ci

# Build full variant (CI target)
docker buildx bake ci-full

# Run basic tests (minimal)
docker run --rm phpbu:ci --version
docker run --rm phpbu:ci --help

# Run basic tests (full)
docker run --rm phpbu:ci-full --version
docker run --rm phpbu:ci-full which rsync gpg ssh

Security Scanning

# Run Trivy locally (minimal variant)
docker run --rm aquasec/trivy image phpbu:ci

# Run Trivy locally (full variant)
docker run --rm aquasec/trivy image phpbu:ci-full

Lint Dockerfile

docker run --rm -i hadolint/hadolint < Dockerfile

Code Style

Dockerfile

  • Use multi-stage builds
  • Minimize layers
  • Run as non-root user
  • Add OCI labels
  • Follow hadolint recommendations

HCL (docker-bake.hcl)

  • Use consistent indentation (2 spaces)
  • Group related targets
  • Document complex configurations

Release Process

Releases are automated via GitHub Actions:

  1. Create a tag: git tag v1.0.0
  2. Push the tag: git push origin v1.0.0
  3. CI builds, tests, signs, and pushes the image

Getting Help

License

By contributing, you agree that your contributions will be licensed under the LGPL-3.0 License.