Skip to content

php:fpm-alpine based Docker image for running Craft CMS

Notifications You must be signed in to change notification settings

Saboteur777/craftcms-php-docker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

craftcms-php-docker

Docker Build status Docker Build mode Docker Pull count Last commit Keybase.io PGP

This Docker image aims to be as simple as possible to run Craft CMS - if you have special dependencies, define this image as a base in your Dockerfile (FROM: webmenedzser/craftcms-php:latest) and extend it as you like.

The image is based on the php:fpm-alpine image.

Pre-installed Composer in the image

Composer is preinstalled, so you could use the following command to run it (in case the service, which is based on this image, is called php in your docker-compose.yml):

docker-compose exec php composer <COMMAND>

Change user and group of PHP

You can change which user should run PHP - just build your image by extending this one, e.g.:

Dockerfile

FROM: webmenedzser/craftcms-php:latest

[...]
RUN apk add shadow && usermod -u 1000 www-data && groupmod -g 1000 www-data
[...]

This will change both the UID and GID of www-data user (which is the default to run PHP) to 1000.

Add custom PHP settings

You can easily add new PHP settings to the image. Just place your .ini file in e.g. the .docker/php folder, and COPY it:

Dockerfile

FROM: webmenedzser/craftcms-php:latest

[...]
COPY .docker/php/settings-override.ini /usr/local/etc/php/conf.d/
[...]

Opcache is enabled by default, so if you want to disable it (for local dev) you can do it with the method mentioned above:

disable-opcache.ini

opcache.enable = 0;

Example usage

docker-compose.yml

version: '3.6'
services:
  web:
    image: webmenedzser/craftcms-nginx:latest
    volumes:
      - ./:/var/www/

  php:
    image: webmenedzser/craftcms-php:latest
    volumes:
      - ./:/var/www/

  database:
    image: mariadb:latest
    volumes:
     - database_volume:/var/lib/mysql

volumes:
  database_volume: {}

Sister image: craftcms-nginx

About

php:fpm-alpine based Docker image for running Craft CMS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published