PHP stack with Supercronic (Cron for Containers)
9.2K
Repository Name: infraunnes/php-cli:alpine
Description:
This Docker image provides a lightweight Alpine Linux environment with PHP, Composer, and Supercronic for running PHP CLI applications and scheduled tasks. It includes essential PHP extensions and tools for development and deployment.
Key Features:
curl, gd, mysqli, mbstring, zip, xml, and json.git, curl, wget, make, rsync, nano, and mysql-client.docker buildx for multi-architecture compatibility (amd64, arm64).Supercronic:
Supercronic is a simple, reliable cron replacement designed for running scheduled tasks inside Docker containers. It reads cron schedules from a specified file (default: /root/crontab.txt) and executes the corresponding commands. This allows you to easily manage cron jobs within your containerized applications.
Usage:
Pull the Image:
docker pull infraunnes/php-cli:8.4-alpine
Create a crontab.txt File:
Create a file named crontab.txt in the same directory as your Dockerfile or docker-compose.yml. This file should contain your cron schedules in standard cron format. For example:
* * * * * php /var/www/your-script.php
Run a Container:
docker run -d -v /path/to/your/crontab.txt:/root/crontab.txt infraunnes/php-cli:8.4alpine
/path/to/your/crontab.txt with the local path to your crontab.txt file.Mount your application:
docker run -d -v /path/to/your/crontab.txt:/root/crontab.txt -v /path/to/your/app:/var/www infraunnes/php-cli:8.4-alpine
/path/to/your/app with the local path to your PHP application.Dockerfile Breakdown:
alpine:edge provides a minimal Alpine Linux environment.apk.curl and php.rootfs: Copies the application code from the rootfs directory into the container's root directory.ENTRYPOINT: Sets tini as the entry point, starting Supercronic with the specified crontab.txt file.CMD: Not used, the entrypoint overrides the command.Customization:
apk add php-<extension-name> to the Dockerfile.SUPERCRONIC_VERSION argument.crontab.txt file, modify the ENTRYPOINT command.Note:
crontab.txt file has the correct file permissions.Content type
Image
Digest
sha256:c40b49c64…
Size
85.4 MB
Last updated
4 months ago
docker pull infraunnes/php-cli:8.5-alpine