/docker-php

Primary LanguageDockerfileMIT LicenseMIT

PHP Docker image

GitHub Actions status Latest Release Software License

PHP is a server-side scripting language designed for web development, but which can also be used as a general-purpose programming language. PHP can be added to straight HTML or it can be used with a variety of templating engines and web frameworks. PHP code is usually processed by an interpreter, which is either implemented as a native module on the web-server or as a common gateway interface (CGI).

Installation

Pull the image from the Container registry. This is the recommended method of installation as it is easier to update image.

docker pull ghcr.io/slavcodev/docker-php:latest

Build the image locally

git clone git@github.com:slavcodev/docker-php.git 
cd docker-php
docker build . --file Dockerfile \
  --tag ghcr.io/slavcodev/docker-php \
  --build-arg PHP_VERSION=8.3-fpm

Quick start

Using docker-compose.yml

services:
  php:
    image: ghcr.io/slavcodev/docker-php:latest
    user: ${USER_ID}:${GROUP_ID}
    working_dir: /var/www/html
    volumes:
        - ${APP_COMPOSER_CACHE}:/home/.composer/cache
        - ${APP_SRC}:/var/www/html
    extra_hosts:
        - "host.docker.internal:host-gateway"

Alternately, you can manually launch the container.

docker run --name='php' \
    ghcr.io/slavcodev/docker-php:latest

Publish changes

The image is hosted on Container registry.

Read the Working with the Container registry to learn how to publish new version of image.

There is an example:

echo $GITHUB_TOKEN | docker login ghcr.io -u USERNAME --password-stdin
docker push -a ghcr.io/slavcodev/docker-php