Skip to content

Commit 64dbd31

Browse files
Merge pull request #2 from Atyantik/php8.4-bullseye
Add support for PHP8.4
2 parents 8d1bafa + 4fdabf2 commit 64dbd31

File tree

6 files changed

+248
-66
lines changed

6 files changed

+248
-66
lines changed

Dockerfile

+60-54
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,69 @@
1-
FROM php:8.3-fpm-bullseye
1+
FROM php:8.4-fpm-bullseye
22

3-
RUN apt-get update && apt-get upgrade -y
4-
RUN apt-get install -y \
5-
$PHPIZE_DEPS \
6-
cmake libfreetype6-dev libfontconfig1-dev xclip \
7-
libpng-dev \
8-
libjpeg-dev \
9-
libc-dev \
10-
jpegoptim optipng pngquant gifsicle \
11-
unzip \
12-
curl \
13-
libzip-dev \
14-
libpq-dev \
15-
pkg-config \
16-
libssl-dev \
17-
libmcrypt-dev \
18-
zlib1g zlib1g-dev \
19-
libxml2-dev \
20-
libonig-dev \
21-
graphviz \
22-
&& docker-php-ext-configure gd \
23-
--with-freetype=/usr/include/ \
24-
--with-jpeg=/usr/include/ && \
25-
docker-php-ext-install gd \
26-
pcntl \
27-
pdo_mysql \
28-
pdo_pgsql \
29-
mbstring \
30-
mysqli \
31-
exif \
32-
zip \
33-
intl
34-
35-
# Install Mongo DB
36-
RUN pecl install mongodb \
37-
&& docker-php-ext-enable mongodb
38-
39-
RUN pecl install redis
40-
RUN docker-php-ext-enable redis
41-
42-
RUN docker-php-ext-install opcache
43-
44-
RUN rm -rf /var/lib/apt/lists/*
45-
46-
# Install composer
47-
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
48-
49-
# Optimize composer ot use only https protocol from packagist
50-
RUN /usr/local/bin/composer config --global repo.packagist composer https://packagist.org
51-
52-
# Install mongodb tools for mongodump
53-
RUN cd /tmp && \
3+
# Install necessary libraries and PHP extensions
4+
RUN apt-get update && apt-get upgrade -y && \
5+
apt-get install -y --no-install-recommends \
6+
$PHPIZE_DEPS \
7+
cmake \
8+
wget \
9+
git \
10+
libfreetype6-dev \
11+
libfontconfig1-dev \
12+
libpng-dev \
13+
libjpeg-dev \
14+
libc-dev \
15+
jpegoptim optipng pngquant gifsicle \
16+
unzip \
17+
curl \
18+
libzip-dev \
19+
libpq-dev \
20+
pkg-config \
21+
libssl-dev \
22+
zlib1g zlib1g-dev \
23+
libxml2-dev \
24+
libonig-dev \
25+
libmemcached-dev \
26+
libgmp-dev \
27+
libsqlite3-dev \
28+
postgresql-client \
29+
graphviz && \
30+
docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ && \
31+
docker-php-ext-install \
32+
gd \
33+
pcntl \
34+
pdo_mysql \
35+
pdo_pgsql \
36+
pdo_sqlite \
37+
mbstring \
38+
mysqli \
39+
exif \
40+
zip \
41+
intl \
42+
soap \
43+
gmp \
44+
opcache && \
45+
pecl install mongodb && docker-php-ext-enable mongodb && \
46+
pecl install memcached && docker-php-ext-enable memcached && \
47+
pecl install redis && docker-php-ext-enable redis && \
48+
pecl install apcu && docker-php-ext-enable apcu && \
49+
pecl install xdebug-3.4.0beta1 && docker-php-ext-enable xdebug && \
50+
echo "xdebug.mode=off" >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini && \
51+
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \
52+
/usr/local/bin/composer config --global repo.packagist composer https://packagist.org && \
53+
cd /tmp && \
5454
curl https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-4.1.6.tgz > mongodb.tar.gz && \
5555
mkdir -p /etc/mongodb && tar xvzf mongodb.tar.gz -C /etc/mongodb --strip-components 1 && \
56-
rm -rf /tmp/mongodb.tar.gz
56+
rm -rf /tmp/mongodb.tar.gz /tmp/* && \
57+
apt-get remove --purge -y $PHPIZE_DEPS && \
58+
apt-get autoremove -y && \
59+
apt-get clean && \
60+
rm -rf /var/lib/apt/lists/*
5761

62+
# Set permissions for Composer
5863
RUN mkdir -p /.composer/ && chmod -R 777 /.composer/
5964

60-
# Expose port 9000 and start php-fpm server
65+
# Expose PHP-FPM port
6166
EXPOSE 9000
6267

68+
# Start PHP-FPM
6369
CMD ["php-fpm"]

README.md

+132-12
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,140 @@
1-
### Create AMD and ARM builds with buildx
2-
```
3-
docker buildx build --platform="linux/amd64" -t atyantik/laravel-php:8.3-bullseye-amd64 .
4-
```
1+
# Atyantik's Laravel PHP Docker Image 🌟
2+
3+
[![Docker Hub](https://img.shields.io/badge/Docker-Hub-blue)](https://hub.docker.com/repository/docker/atyantik/laravel-php)
4+
5+
This repository provides a **custom PHP 8.4 Docker image** based on the Bullseye distribution, optimized for running Laravel applications. It includes pre-installed PHP extensions, tools, and multi-architecture support for **AMD64** and **ARM64**. 🚀
6+
7+
---
8+
9+
## ✨ Features: What This Dockerfile Provides
10+
11+
This Dockerfile is tailored for **Laravel** applications and includes the following features:
12+
13+
1. **PHP 8.4** with FPM (FastCGI Process Manager).
14+
2.**Pre-installed PHP Extensions**:
15+
- Essential extensions required by most Laravel applications.
16+
- See the [Extension Table](#php-extensions) below for a full list. 🧩
17+
3.**Pre-installed Tools**:
18+
- **Composer** (globally available for dependency management).
19+
- **MongoDB Tools** (e.g., `mongodump`) for database backups and operations.
20+
4.**Xdebug**:
21+
- Included but disabled by default for production readiness.
22+
- XDebug 3.4.0beta1 is used for compatibility with php 8.4
23+
5.**Multi-Architecture Builds**:
24+
- Supports both AMD64 (x86_64) and ARM64 (aarch64) architectures.
25+
26+
---
27+
28+
## 🧩 PHP Extensions
29+
30+
Here’s a detailed list of pre-installed PHP extensions:
31+
32+
| Extension | Description | Status |
33+
|----------------------|-------------------------------------------------------|--------|
34+
| **pdo_mysql** | MySQL database support ||
35+
| **pdo_pgsql** | PostgreSQL database support ||
36+
| **pdo_sqlite** | SQLite lightweight database support ||
37+
| **mbstring** | Multibyte string handling for UTF-8 support ||
38+
| **intl** | Internationalization and localization features ||
39+
| **gd** | Image processing (JPEG, PNG) ||
40+
| **zip** | Support for ZIP compression ||
41+
| **opcache** | Performance optimization through script caching ||
42+
| **soap** | SOAP-based web services ||
43+
| **redis** | Redis for caching and sessions ||
44+
| **memcached** | Memcached for caching and sessions ||
45+
| **mongodb** | MongoDB database support ||
46+
| **gmp** | Arbitrary precision arithmetic ||
47+
| **exif** | Metadata handling for images ||
48+
49+
---
50+
51+
## 🛠 Pre-installed Tools
52+
53+
1. **Composer**:
54+
- Installed globally for dependency management.
55+
- Optimized to use only HTTPS for Packagist repositories.
56+
57+
2. **MongoDB Tools**:
58+
- Includes **mongodump** for backup operations and other utilities.
59+
60+
---
61+
62+
## 🚀 How to Use
563

64+
This Docker image is available on [Docker Hub](https://hub.docker.com/repository/docker/atyantik/laravel-php). You can pull it directly or use it as a base image in your own Dockerfile:
65+
66+
```dockerfile
67+
FROM atyantik/laravel-php:8.4-bullseye
668
```
7-
docker buildx build --platform="linux/arm64" -t atyantik/laravel-php:8.3-bullseye-arm64 .
8-
```
969

10-
### Push both to docker hub
11-
docker push atyantik/laravel-php:8.3-bullseye-arm64
12-
docker push atyantik/laravel-php:8.3-bullseye-amd64
70+
### Example: Running a Laravel Application
71+
72+
1. Build your Laravel application image using this base image:
73+
```dockerfile
74+
FROM atyantik/laravel-php:8.4-bullseye
75+
76+
COPY . /var/www/html
77+
WORKDIR /var/www/html
78+
79+
RUN composer install --no-dev --optimize-autoloader
80+
```
81+
2. Start the container:
82+
```bash
83+
docker run -p 8000:9000 my-laravel-app
84+
```
85+
86+
---
87+
88+
## 🛠 Compilation Steps
89+
90+
Follow these steps to build the image yourself:
91+
92+
1. **Clone the Repository**:
93+
```bash
94+
git clone https://github.com/atyantik/laravel-php-docker.git
95+
cd laravel-php-docker
96+
```
97+
98+
2. **Enable Buildx for Multi-Architecture Builds**:
99+
- If Buildx is not set up, enable it by following [Docker's Buildx Guide](https://docs.docker.com/buildx/working-with-buildx/).
100+
101+
3. **Build AMD64 Image**:
102+
```bash
103+
docker buildx build --platform="linux/amd64" -t atyantik/laravel-php:8.4-bullseye-amd64 .
104+
```
105+
106+
4. **Build ARM64 Image**:
107+
```bash
108+
docker buildx build --platform="linux/arm64" -t atyantik/laravel-php:8.4-bullseye-arm64 .
109+
```
110+
111+
5. **Push Images to Docker Hub**:
112+
```bash
113+
docker push atyantik/laravel-php:8.4-bullseye-amd64
114+
docker push atyantik/laravel-php:8.4-bullseye-arm64
115+
```
116+
117+
6. **Create and Push a Manifest for Multi-Architecture**:
118+
```bash
119+
docker manifest create atyantik/laravel-php:8.4-bullseye \
120+
atyantik/laravel-php:8.4-bullseye-amd64 \
121+
atyantik/laravel-php:8.4-bullseye-arm64
122+
docker manifest push atyantik/laravel-php:8.4-bullseye
123+
```
124+
125+
---
126+
127+
## 🌐 Links
128+
129+
- **Docker Hub Repository**: [https://hub.docker.com/repository/docker/atyantik/laravel-php](https://hub.docker.com/repository/docker/atyantik/laravel-php)
130+
- **Atyantik Technologies**: [atyantik.com](https://atyantik.com)
13131

132+
---
14133

15-
`// docker manifest rm atyantik/laravel-php:8.3 atyantik/laravel-php:8.3-bullseye-amd64 atyantik/laravel-php:8.3-bullseye-arm64`
134+
## 🤝 About Atyantik Technologies
16135

17-
docker manifest create atyantik/laravel-php:8.3-bullseye atyantik/laravel-php:8.3-bullseye-amd64 atyantik/laravel-php:8.3-bullseye-arm64
136+
![Atyantik Logo](https://cdn.atyantik.com/atyantik-logo.png)
18137

19-
docker manifest push atyantik/laravel-php:8.3-bullseye
138+
At **Atyantik Technologies**, we specialize in building world-class software solutions with a focus on innovation, scalability, and efficiency. We believe in delivering value through cutting-edge technologies and industry best practices.
20139

140+
💻 Visit us at: [atyantik.com](https://atyantik.com)

example/docker-compose.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
services:
2+
app:
3+
image: atyantik/laravel-php:8.4-bullseye
4+
container_name: php_app
5+
volumes:
6+
- ./public:/var/www/html
7+
- ./php/php.ini:/usr/local/etc/php/php.ini
8+
networks:
9+
- app_network
10+
11+
webserver:
12+
image: nginx:latest
13+
container_name: nginx_web
14+
volumes:
15+
- ./public:/var/www/html
16+
- ./nginx/default.conf:/etc/nginx/conf.d/default.conf
17+
ports:
18+
- "8080:80"
19+
depends_on:
20+
- app
21+
networks:
22+
- app_network
23+
24+
networks:
25+
app_network:
26+
driver: bridge

example/nginx/default.conf

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
server {
2+
listen 80;
3+
server_name localhost;
4+
5+
root /var/www/html;
6+
index index.php index.html;
7+
8+
location / {
9+
try_files $uri $uri/ /index.php?$query_string;
10+
}
11+
12+
location ~ \.php$ {
13+
include fastcgi_params;
14+
fastcgi_pass app:9000;
15+
fastcgi_index index.php;
16+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
17+
}
18+
19+
location ~ /\.ht {
20+
deny all;
21+
}
22+
}

example/php/php.ini

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
display_errors = On
2+
memory_limit = 256M
3+
upload_max_filesize = 50M
4+
post_max_size = 50M
5+
xdebug.mode = off

example/public/index.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
phpinfo();
3+
die();

0 commit comments

Comments
 (0)