Sign inSign up

drakemazzy/ddk-coder

By drakemazzy

Updated about 1 year ago

Image with Code Quality Tools (phpcs, phpcbf, yaml-lint) based on drupal/coder project

Image
Integration & delivery
Developer tools
0

1.9K

drakemazzy/ddk-coder repository overview

Docker Image CI Docker Pulls Docker Image Size Docker Stars License: GPL-2.0-or-later

This project provides a Docker image that includes:

Usage

Pull the Image
docker pull drakemazzy/ddk-coder:latest
Running Code Quality Checks

Basic usage:

docker run --rm -v $(pwd):/tmp drakemazzy/ddk-coder:latest phpcs /tmp

With custom configuration:

docker run --rm -v $(pwd):/tmp -v $(pwd)/phpcs.xml:/opt/coder/phpcs.xml drakemazzy/ddk-coder:latest phpcs /tmp
Available Commands
  • PHP CodeSniffer:
    docker run --rm drakemazzy/ddk-coder:latest phpcs --version
    docker run --rm drakemazzy/ddk-coder:latest phpcbf --version
    
Integration Examples
Bitbucket Pipelines

Add this to your bitbucket-pipelines.yml:

pipelines:
  default:
    - step:
        image: drakemazzy/ddk-coder:latest
        name: Code Quality
        script:
          - phpcs --standard=/opt/coder/phpcs.xml ./src

With custom configuration:

pipelines:
  default:
    - step:
        image: drakemazzy/ddk-coder:latest
        name: Code Quality
        artifacts:
          - phpcs.xml
        script:
          - cp ./build/phpcs.xml /opt/coder/phpcs.xml
          - phpcs ./src
GrumPHP Integration
  1. Install GrumPHP in your project:
composer require --dev phpro/grumphp
  1. Configure GrumPHP (grumphp.yml):
grumphp:
  tasks:
    phpcs:
      standard: /opt/coder/phpcs.xml
      triggered_by: [php]
      whitelist_patterns:
        - /^src\/(.*)/
        - /^tests\/(.*)/
  docker:
    image: drakemazzy/ddk-coder:latest
    workdir: /tmp
    volumes:
      - ${PWD}:/tmp
  1. Run GrumPHP:
docker run --rm -v $(pwd):/tmp drakemazzy/ddk-coder:latest vendor/bin/grumphp run
Pre-commit Hook with GrumPHP

Add to your .git/hooks/pre-commit:

#!/bin/sh
docker run --rm -v $(pwd):/tmp drakemazzy/ddk-coder:latest vendor/bin/grumphp git:pre-commit

Make the hook executable:

chmod +x .git/hooks/pre-commit

Build Arguments

The image supports the following build arguments:

ArgumentDescriptionDefault
PHP_VERPHP version84
COMPOSER_VERComposer version2.8.5
CODER_VERCoder version8.3.28
BUILD_VERBuild versiongit SHA
BUILD_DATEBuild dateCurrent UTC

Multi-Platform Support

The image is available for the following platforms:

  • linux/amd64
  • linux/arm64

Security Features

This image includes:

  • SBOM (Software Bill of Materials)
  • Build provenance
  • Trivy security scanning

Development

Prerequisites
  • Docker
  • Docker Buildx
  • GitHub Actions Runner (for CI/CD)
Local Build
docker buildx build --platform linux/amd64,linux/arm64 -t drakemazzy/ddk-coder:latest .

License

This project is released under the GNU General Public License v2.0 (as provided by GitHub), with the "or (at your option) any later version" clause, because pfrenssen/coder is licensed under GPL-2.0-or-later.

In short:

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 (or at your option) any later version.

For more details, see the LICENSE file in this repository or the official GPL v2 text.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

If you encounter any problems or have suggestions, please open an issue in the GitHub repository.

Tag summary

Content type

Image

Digest

sha256:fb199495c

Size

11.2 MB

Last updated

about 1 year ago

docker pull drakemazzy/ddk-coder