Skip to content

PHP docker image for local development.

Notifications You must be signed in to change notification settings

arogachev/docker-dev-php

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vjik/dev-php Docker Image

PHP docker image for local development that include:

General usage

Pull image from DockerHub

Image on DockerHub, docker pull command:

docker pull vjik/dev-php:8.1

Tags are named by PHP version used: 8.1, 8.0, 7.4.

Run container

Recommended run command:

docker run -it --rm --name dev-php -v /host/projects:/projects -w /projects vjik/dev-php:8.1 --uname vjik --uid 1000 --gname vjik -gid 1000
  • -it — Interactive mode with allocate a pseudo terminal.
  • --rm — Automatically remove the container when it exits.
  • --name dev-php — Assign name "dev-php" to the container.
  • -v /host/projects:/projects — Mount folder with your projects (replace /host/projects to your path) to container (/projects).
  • -w /projects — Set /projects as working directory inside the container.
  • vjik/dev-php:8.1 — Image name.
  • --uname vjik — Set username in container.
  • --uid 1000 — Set user ID in container.
  • --gname vjik — Set user group name in container.
  • --gid 1000 — Set user group ID in container.

Recommended to use the same username and group as in your system.

SSH configuration

You can configure SSH in container via mount folder with SSH configuration to path /config/.ssh. To do this, add the appropriate argument to the container run command. For example:

-v ~/.ssh:/config/.ssh

GIT configuration

You can configure GIT in container via mount configuration file .gitconfig to path /config/.gitconfig. To do this, add the appropriate argument to the container run command. For example:

-v ~/.gitconfig:/config/.gitconfig

GnuPG configuration

You can configure GnuPG in container via mount folder with GnuPG configuration to path /config/.gnupg. To do this, add the appropriate argument to the container run command. For example:

-v ~/dev-gnupg:/config/.gnupg

Recommend don't use system .gnupg directory. Better create new directory and mount it.

To request passphrase in terminal add pinentry-mode loopback option to gpg.conf file (create if not exist).

Features

Aliases

Alias Command
c composer
cu composer update
pu ./vendor/bin/phpunit
puc ./vendor/bin/phpunit --coverage-html=cover
puct ./vendor/bin/phpunit --coverage-text
puf ./vendor/bin/phpunit --filter
psalm ./vendor/bin/psalm --no-cache
psalm74 ./vendor/bin/psalm --no-cache --php-version=7.4
psalm80 ./vendor/bin/psalm --no-cache --php-version=8.0
psalm81 ./vendor/bin/psalm --no-cache --php-version=8.1
cls clear

Build an image

Use Task for simplify run:

task build74 # PHP 7.4
task build80 # PHP 8.0
task build81 # PHP 8.1
task build82 # PHP 8.2

About

PHP docker image for local development.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Shell 59.8%
  • Dockerfile 40.2%