Sign inSign up

haroonmahmood4276/php

By haroonmahmood4276

•Updated about 2 years ago

A minimal php repository for development and production. Suitable for Laravel as well.

Image
Languages & frameworks
0

877

haroonmahmood4276/php repository overview

I have installed only a few following packages that are required mostly for PHP/Laravel development including PDO, PDO_MYSQL, PDO_PGSQL, MongoDB, Redis

bash
unzip
php
php-bcmath
php-bz2
php-cli
php-common
php-ctype
php-curl
php-dom
php-dev
php-exif
php-fileinfo
php-gd
php-gmp
php-iconv
php-intl
php-json
php-mbstring
php-mongodb
php-mysqli
php-opcache
php-openssl
php-pdo
php-pgsql
php-phar
php-redis
php-session
php-simplexml
php-tokenizer
php-xdebug
php-xml
php-xmlreader
php-xmlwriter
php-zip
php-json
php-pdo
php-pear
php-pdo_mysql
php-pdo_pgsql

⁠How to use this image

⁠In PHP

⁠Create a Dockerfile at the root of your project
FROM haroonmahmood4276/php:8.3-alpine3.20-dev

# Set the working directory
WORKDIR /usr/src/myapp

# Copy the application code
COPY . /usr/src/myapp

# Expose port 8000
EXPOSE 8000

# Start Application
CMD ["php", "./your-script.php"]

Then, run the commands to build and run the Docker image:

docker build -t my-php-app .
docker run -it --rm --name my-running-app my-php-app
⁠Run a single PHP script

For many simple, single-file projects, you may find it inconvenient to write a complete Dockerfile. In such cases, you can run a PHP script by using the PHP Docker image directly:

$ docker run -it --rm --name my-running-script -v "$PWD":/usr/src/myapp -w /usr/src/myapp haroonmahmood4276/php:8.3-alpine3.20-dev php your-script.php

⁠In Laravel

FROM FROM haroonmahmood4276/php:8.3-alpine3.20-dev

# Set the working directory
WORKDIR /laravel/app

# Copy the application code
COPY . .

# Set permissions for storage and cache
RUN chmod -R 755 /home/laravel/app/storage && chmod -R 755 /home/laravel/app/bootstrap/cache

# Install Composer
COPY --from=composer:latest /usr/bin/composer /usr/bin/composer

# Install PHP dependencies
RUN composer install --no-dev --optimize-autoloader

# Expose port 8000
EXPOSE 8000

# Start Application
CMD ["php", "artisan", "serve", "--host=0.0.0.0"]

Then, run the commands to build and run the Docker image:

docker build -t my-laravel-app .
docker run -it --rm --name my-running-app my-laravel-app

⁠Which tag is suitable for you?

⁠Tags <phpversion>-<alpineversion>-dev

The php packages, that are used for development purposes only, are installed in the image.

Tag summary

Content type

Image

Digest

sha256:8862f6d20…

Size

38.7 MB

Last updated

about 2 years ago

docker pull haroonmahmood4276/php:8.3-alpine3.19-dev