This commit is contained in:
Shihaam Abdul Rahman 2023-10-14 23:50:51 +05:00
commit 5d1a7c80df
Signed by: shihaam
GPG Key ID: 6DA2E87EBC227636
17 changed files with 6180 additions and 0 deletions

22
5.6/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM php:5.6-stretch
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
# Update stretch repositories
RUN sed -i -e 's/deb.debian.org/archive.debian.org/g' \
-e 's|security.debian.org|archive.debian.org/|g' \
-e '/stretch-updates/d' /etc/apt/sources.list
# Install basic tools
RUN apt update \
&& apt install curl nano iputils-ping libzip-dev zip unzip libfreetype6-dev libjpeg62-turbo-dev -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
## Install composer and some base extensions
# Configure and Install mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install {mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}

17
5.6/docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '3.5'
services:
#########################
fpm:
build:
context: .
dockerfile: Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: fpm
image: git.shihaam.dev/dockerfiles/php-fpm:5.6

22
7.1.33/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM php:7.1.33-fpm-buster
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
# Install basic tools
## libzip-dev is required for php-zip
## libfreetype6-dev libjpeg62-turbo-dev are required for php-gd
RUN apt update \
&& apt install curl nano iputils-ping libzip-dev zip unzip libfreetype6-dev libjpeg62-turbo-dev -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
## Install composer and some base extensions
# Configure and Install mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install {mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}
# Copy php.ini config
COPY php.ini /usr/local/etc/php/php.ini

17
7.1.33/docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '3.5'
services:
#########################
fpm:
build:
context: .
dockerfile: Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: fpm
image: git.shihaam.dev/dockerfiles/php-fpm:7.1.33

17
7.1.33/extra.Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Install Image Magick
RUN apt-get update \
&& apt-get install libmagickwand-dev --no-install-recommends -y \
&& pecl install imagick \
&& docker-php-ext-enable imagick
# Install intl
RUN apt-get -y update \
&& apt-get install -y libicu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl

1955
7.1.33/php.ini Normal file

File diff suppressed because it is too large Load Diff

22
7.2/Dockerfile Normal file
View File

@ -0,0 +1,22 @@
FROM php:7.2-fpm-buster
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
# Install basic tools
## libzip-dev is required for php-zip
## libfreetype6-dev libjpeg62-turbo-dev are required for php-gd
RUN apt update \
&& apt install curl nano iputils-ping libzip-dev zip unzip libfreetype6-dev libjpeg62-turbo-dev -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
## Install composer and some base extensions
# Configure and Install mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install {mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}
# Copy php.ini config
COPY php.ini /usr/local/etc/php/php.ini

17
7.2/docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '3.5'
services:
#########################
fpm:
build:
context: .
dockerfile: Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: fpm
image: git.shihaam.dev/dockerfiles/php-fpm:7.2

17
7.2/extra.Dockerfile Normal file
View File

@ -0,0 +1,17 @@
# Install Image Magick
RUN apt-get update \
&& apt-get install libmagickwand-dev --no-install-recommends -y \
&& pecl install imagick \
&& docker-php-ext-enable imagick
# Install intl
RUN apt-get -y update \
&& apt-get install -y libicu-dev \
&& docker-php-ext-configure intl \
&& docker-php-ext-install intl

1933
7.2/php.ini Normal file

File diff suppressed because it is too large Load Diff

20
7.3.33/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM php:7.3.33-fpm-bullseye
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
# Install basic tools
## libzip-dev is required for php-zip
## libfreetype6-dev libjpeg62-turbo-dev are required for php-gd
RUN apt update \
&& apt install curl nano iputils-ping zip libzip-dev unzip libfreetype6-dev libjpeg62-turbo-dev -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
## Install composer and some base extensions
# Configure and Install mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& docker-php-ext-configure pcntl --enable-pcntl \
&& docker-php-ext-configure zip --with-libzip \
&& docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ \
&& docker-php-ext-install {mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}

17
7.3.33/docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '3.5'
services:
#########################
fpm:
build:
context: .
dockerfile: Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: fpm
image: git.shihaam.dev/dockerfiles/php-fpm:7.3.33

20
8.2.3/Dockerfile Normal file
View File

@ -0,0 +1,20 @@
FROM php:8.2.3-fpm-bullseye
# Set build shell to bash, default has has some issues sometimes
SHELL ["/bin/bash", "-c"]
# Install basic tools
## libzip-dev is required for php-zip
## libfreetype6-dev libjpeg62-turbo-dev are required for php-gd
RUN apt update \
&& apt install curl nano iputils-ping libzip-dev zip unzip libfreetype6-dev libjpeg62-turbo-dev -y --no-install-recommends \
&& apt auto-remove -y \
&& apt clean -y
## Install composer and some base extensions
# Configure and Install mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer \
&& docker-php-ext-install {mysqli,pdo,pdo_mysql,bcmath,calendar,zip,gettext,exif,pcntl,shmop,-j$(nproc),gd,sysvmsg,sysvsem,sysvshm}
# Copy php.ini config
COPY php.ini /usr/local/etc/php/php.ini

17
8.2.3/docker-compose.yml Normal file
View File

@ -0,0 +1,17 @@
version: '3.5'
services:
#########################
fpm:
build:
context: .
dockerfile: Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: fpm
image: git.shihaam.dev/dockerfiles/php-fpm:8.2.3

1963
8.2.3/php.ini Normal file

File diff suppressed because it is too large Load Diff

87
README.md Normal file
View File

@ -0,0 +1,87 @@
# php-fpm
- These containes are meant to be used as base images for app container with custom nginx container that expects volume from fpm container.
## Multi-arch support
- Install emualtor:
```bash
docker run --privileged --rm tonistiigi/binfmt --uninstall qemu-* #Uninstall existing
docker run --privileged --rm tonistiigi/binfmt --install all
```
- You may need to set these variable before running build if you have pre Docker v23
```bash
export COMPOSE_DOCKER_CLI_BUILD=1
export DOCKER_BUILDKIT=1
```
Enable (1) or disable (0) BuildKit builds
#### Adding new version
- copy one of the folders in this repo with new version number and edit Docker file in the new folder as needed.
#### Building new container
- `cd` into a folder and run `docker buildx bake --load`
#### Pushing built container to registry
- `cd` into a folder and run `docker buildx bake --push`
###
- Avoid adding app specifc depdencies to base images.
### Custom building
- go to app repo and create a .build dir and create `docker-compose.yml` with the following content:
```yaml
version: '3.5'
services:
#########################
fpm:
build:
context: ../
dockerfile: .build/fpm.Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: fpm
image: git.shihaam.dev/dockerfiles/<app>/fpm
#########################
nginx:
build:
context: .
dockerfile: nginx.Dockerfile
x-bake:
pull: true
platforms:
- linux/amd64/v1
- linux/amd64/v2
- linux/amd64/v3
- linux/arm/v7
- linux/arm64
hostname: nginx
image: git.shihaam.dev/dockerfiles/<app>/nginx
```
## running the app
- Save the following in project dir as `docker-compose.yml` and run `docker compose up`
```yaml
version: '3.5'
services:
#########################
fpm:
hostname: fpm
image: git.shihaam.dev/dockerfiles/<app>/fpm
env_file:
- env
volumes:
- ./public:/var/www/html/storage/app/public
#########################
nginx:
hostname: nginx
image: git.shihaam.dev/dockerfiles/<>/nginx
ports:
- 8000:80
volumes_from:
- fpm
```

17
build-all.sh Executable file
View File

@ -0,0 +1,17 @@
#!/bin/bash
#COMPOSE_DOCKER_CLI_BUILD=1
#DOCKER_BUILDKIT=1
#DOCKER_DEFAULT_PLATFORM=linux/amd64
# Loop through each directory
for dir in */; do
# Change into the directory
cd "$dir"
# Run docker build and push
docker buildx bake --push
# Change back to the parent directory
cd ..
done