diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..1bea01a --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,49 @@ +# Contributing Guide + +Thank you for your interest in contributing! This repository hosts versioned PHP Docker images with optional NVM and Node.js support. + +## ๐Ÿ“‹ Contribution Checklist + +Before opening a Pull Request, please make sure that: + +- You are modifying or adding files in the correct version folder (e.g. `8.3/Dockerfile`) +- Your PR **title follows the [Conventional Commits](https://www.conventionalcommits.org/) format** and includes a valid **scope** + - โœ… Correct examples: + - `feat(8.4): add support for PHP 8.4` + - `fix(8.3): correct NVM install path` + - `chore(8.3): update nvm version` + - โŒ Invalid examples (missing scope or wrong format): + - `feat: add PHP 8.4` โ† missing scope + - `fix php 8.3 image` โ† not a conventional commit format + +> The `scope` must describe the context of the change, such as the PHP version (`8.0`, `8.3`, etc.) or a general target like `docker` or `ci`. + +- Your Dockerfile change builds successfully + - The GitHub workflow will attempt to build the image automatically + - You can also test locally with: + ```sh + docker build -t php-custom:8.3 ./8.3 + ``` + +## โœ… Best Practices + +- **Avoid modifying multiple PHP versions in a single PR** unless necessary +- Keep version-specific differences minimal and well-documented in `README.md` if needed +- If adding a new PHP version (e.g. `8.4`), use the closest previous version (e.g. `8.3`) as a starting point + +## ๐Ÿงช CI Workflow + +All PRs trigger a GitHub Actions workflow which will: + +- Validate the PR title against Conventional Commits with required scope +- Build the updated Docker image to ensure it compiles successfully + +After a successful squash merge a GitHub Actions workflow will publish the new versions to Docker Hub. + +You can find the workflow definitions at [.github/workflows](.github/workflows). + +## ๐Ÿ›ก๏ธ Security + +If you're introducing or updating external binaries (e.g. Node.js, NVM), use official sources and verify integrity (e.g. via checksum or GPG). + +If you're unsure about anything, feel free to open a draft PR or discussion. diff --git a/README.md b/README.md index d2fee78..c56f1c8 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,74 @@ # php-nvm -๐Ÿณ Generic docker image for PHP applications that contains nvm for handling multiple Node.js versions dynamically +๐Ÿณ **php-nvm** is a generic, lightweight Docker image for PHP applications that includes [NVM](https://github.com/nvm-sh/nvm), allowing dynamic management of multiple Node.js versions at runtime. -[![Docker Badge](https://img.shields.io/docker/pulls/ocreaper/php-nvm)](https://hub.docker.com/r/ocreaper/php-nvm/) ![Static Badge](https://img.shields.io/badge/nvm-v0.40.3-blue) +[![Docker Pulls](https://img.shields.io/docker/pulls/ocreaper/php-nvm)](https://hub.docker.com/r/ocreaper/php-nvm/) +![NVM Version](https://img.shields.io/badge/nvm-v0.40.3-blue) +--- -| Tags | PHP version | Features | -|------|-------------| - | -| 8.0 | 8.0 | โœ… Everything. | -| 8.1 | 8.1 | โœ… Everything. | -| 8.2 | 8.2 | โœ… Everything. | -| 8.3 | 8.3 | โœ… Everything. | -| 8.4 | 8.4 | โœ… Everything. | +## ๐Ÿš€ Features + +- โœ… PHP 8.x support (8.0โ€“8.4) +- โœ… Pre-installed [NVM](https://github.com/nvm-sh/nvm) for managing multiple Node.js versions +- โœ… Ideal for modern full-stack PHP projects that require Node.js tooling (e.g. Webpack, Vite, etc.) +- โœ… CI-friendly: small, clean, and consistently versioned +- โœ… Useful system tools: `git`, `rsync`, `openssh-client`, `make`, `curl`, etc. +- โœ… All images share the same consistent build logic + +--- + +## ๐Ÿ“ฆ Available Tags + +| Tag | PHP Version | Included Tools | +|------|-------------|----------------------------------------| +| 8.0 | 8.0 | โœ… PHP, Composer, NVM, Node.js via NVM | +| 8.1 | 8.1 | โœ… PHP, Composer, NVM, Node.js via NVM | +| 8.2 | 8.2 | โœ… PHP, Composer, NVM, Node.js via NVM | +| 8.3 | 8.3 | โœ… PHP, Composer, NVM, Node.js via NVM | +| 8.4 | 8.4 | โœ… PHP, Composer, NVM, Node.js via NVM | + +> โ„น๏ธ The exact Node.js version is not preinstalled โ€” use `nvm install` as needed in your Dockerfile or entrypoint script. + +--- + +## ๐Ÿงช Usage + +### ๐Ÿ‹ Example Dockerfile + +```Dockerfile +FROM ocreaper/php-nvm:8.3 + +# Install Node.js 18 using NVM +RUN source ~/.nvm/nvm.sh && \ + nvm install 18 && \ + nvm use 18 && \ + node -v && npm -v + +# Set up your app +COPY . /app +WORKDIR /app +RUN composer install +``` + +### ๐Ÿ’ป Run it interactively + +```sh +docker run -it --rm ocreaper/php-nvm:8.3 bash +``` + +## ๐Ÿค Contributing + +Any contributions are welcomed! + +Use Conventional Commits with a required scope: + +- โœ… feat(8.4): add PHP 8.4 support +- โœ… fix(8.3): correct NVM installation path + +GitHub Actions will: + +- โœ… Enforce PR title formatting +- โœ… Ensure the Docker image builds successfully + +See [CONTRIBUTING.md](CONTRIBUTING.md) for full contribution guidelines.