2023-10-14 23:50:51 +05:00
2023-10-14 23:50:51 +05:00
2023-10-14 23:50:51 +05:00
2024-06-29 15:24:57 +05:00
2024-06-16 02:19:38 +05:00
2024-06-16 02:19:38 +05:00
2024-09-22 23:09:14 +05:00
2023-10-14 23:50:51 +05:00
2024-09-22 23:01:45 +05:00
2023-10-14 23:52:13 +05:00
2023-10-14 23:52:13 +05:00
2023-10-14 23:50:51 +05:00

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:
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
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:
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
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
Description
php fpm configured to work in docker with this nginx container https://git.shihaam.dev/dockerfiles/nginx-fpm
Readme 66 KiB
Languages
Dockerfile 93.4%
Shell 6.6%