Sign inSign up

basshub/php

By basshub

Updated about 3 years ago

php image with additional extensions and ready for almost php project

Image
0

6.5K

basshub/php repository overview

  • 8, 8.2

  • composer, 8-composer, 8.2-composer

  • dev, 8-dev, 8.2-dev

  • 7, 7.4

  • 7-composer, 7.4-composer

  • 7-dev, 7.4-dev

  • 7-laravel, 7.4-laravel

How to use this image

Image Variants

basshub/php:<version>

This variant is the base image for all another variants

Use custom nginx conf

default.conf example

server {
    listen 80 default_server;
    listen [::]:80 default_server;

    root /var/www/html;

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-Content-Type-Options "nosniff";

    index index.php;

    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_pass unix:/var/run/php-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

Dockerfile

FROM basshub/php:7.4

ENV PROJECT_ROOT /var/www/html

COPY default.conf /etc/nginx/http.d/

COPY . $PROJECT_ROOT
Adding Postgresql support

Dockerfile

FROM basshub/php:7.4

RUN set -eux; \
        apk add --no-cache \
            postgresql-dev \
        ; \
        docker-php-ext-install \
            pgsql \
            pdo_pgsql \
        ;

basshub/php:<version>-composer

This variant contains composer latest

basshub/php:<version>-dev

This variant contains composer latest, xdebug 3.1

basshub/php:<version>-laravel

This variant contains compsoer latest and nodejs for building laravel app

Building with Dockerfile
FROM basshub/php:7.4-laravel AS builder

ENV PROJECT_ROOT /var/www/html
WORKDIR $PROJECT_ROOT


COPY --chmod=775 composer.json composer.lock $PROJECT_ROOT/
RUN composer install --no-scripts
COPY --chmod=775 package.json yarn.lock $PROJECT_ROOT/
RUN yarn

COPY --chmod=775 ./ $PROJECT_ROOT
RUN composer run post-autoload-dump
RUN yarn prod
RUN rm -rf node_modules

RUN chmod -R 777 $PROJECT_ROOT/public/


FROM basshub/php:7.4 AS release

COPY --from=builder $PROJECT_ROOT $PROJECT_ROOT

Tag summary

Content type

Image

Digest

sha256:9e131004e

Size

35.4 MB

Last updated

about 3 years ago

docker pull basshub/php