Skip to content

Commit 228f0e3

Browse files
authored
Merge pull request #6 from cwbit/cakephp-5x
Cakephp 5x
2 parents 07539ce + be38242 commit 228f0e3

File tree

4 files changed

+32
-25
lines changed

4 files changed

+32
-25
lines changed

README.md

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This setup spools up the following containers
55

66
* **mysql** (8.0)
77
* **nginx**
8-
* **php-fpm** (php 7.4)
8+
* **php-fpm** (php 8.1)
99
* **mailhog** (smtp server for testing)
1010

1111
The guide will walk you thru the following things
@@ -29,7 +29,7 @@ For those looking to get started in `60 sec` using just the defaults (which are
2929
* and the files from this repo into the `docker` folder
3030

3131
```
32-
somefolder
32+
myapp
3333
docker
3434
.. put the zip files in here ..
3535
cakephp
@@ -65,16 +65,20 @@ For those looking to get started in `60 sec` using just the defaults (which are
6565
Starting myapp-mailhog
6666
Starting myapp-php-fpm
6767
Starting myapp-nginx
68-
Attaching to myapp-mailhog, myapp-mysql, myapp-php-fpm, myapp-nginx
69-
myapp-mailhog | 2017/06/15 16:34:26 Using in-memory storage
70-
...
71-
myapp-mysql | 2017-06-15T16:34:27.401334Z 0 [Note] mysqld (mysqld 5.7.17) starting as process 1 ...
72-
...
73-
myapp-mysql | 2017-06-15T16:34:27.408857Z 0 [Warning] Setting lower_case_table_names=2 because file system for /var/lib/mysql/ is case insensitive
74-
...
75-
myapp-mysql | 2017-06-15T16:34:28.332626Z 0 [Note] mysqld: ready for connections.
76-
myapp-mysql | Version: '5.7.17' socket: '/var/run/mysqld/mysqld.sock' port: 3306 MySQL Community Server (GPL)
77-
myapp-mailhog | [APIv1] KEEPALIVE /api/v1/events
68+
Attaching to myapp-mailhog, myapp-mysql, myapp-nginx, myapp-php-fpm
69+
myapp-mailhog | 2024/06/12 15:59:39 Using in-memory storage
70+
myapp-mailhog | 2024/06/12 15:59:39 [SMTP] Binding to address: 0.0.0.0:1025
71+
myapp-mailhog | 2024/06/12 15:59:39 Serving under http://0.0.0.0:8025/
72+
myapp-mailhog | [HTTP] Binding to address: 0.0.0.0:8025
73+
myapp-mailhog | Creating API v1 with WebPath:
74+
myapp-mailhog | Creating API v2 with WebPath:
75+
myapp-mysql | 2024-06-12 15:59:39+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 8.0.27-1debian10 started.
76+
myapp-php-fpm | [12-Jun-2024 15:59:39] NOTICE: fpm is running, pid 1
77+
myapp-php-fpm | [12-Jun-2024 15:59:39] NOTICE: ready to handle connections
78+
myapp-php-fpm | [12-Jun-2024 15:59:39] NOTICE: systemd monitor interval set to 10000ms
79+
myapp-nginx | /docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration
80+
myapp-nginx | /docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d/
81+
myapp-nginx | /docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh
7882
... you'll probably see more crap spit out here ...
7983
```
8084
5. If you're creating a new cakephp app, follow the steps in [creating a CakePHP app](#creating-a-CakePHP-app)
@@ -91,7 +95,7 @@ Clone this repo (or just download the zip) and put it in a `docker` folder insid
9195
Here is an example of what my typical setup looks like
9296

9397
```
94-
myapp-folder
98+
myapp
9599
cakephp
96100
src
97101
config
@@ -214,10 +218,10 @@ This container runs `php` (and it's extensions) needed for your CakePHP app
214218

215219
It automatically includes the following extensions
216220

217-
* `php7.4-intl` (required for CakePHP 4.0+)
218-
* `php7.4-mbstring`
219-
* `php7.4-sqlite3` (required for DebugKit)
220-
* `php7.4-mysql`
221+
* `php8.1-intl` (required for CakePHP 4.0+)
222+
* `php8.1-mbstring` (included in the base image)
223+
* `php8.1-sqlite3` (required for DebugKit)
224+
* `php8.1-mysql`
221225

222226
It also includes some php ini overrides (see `php-fpm\php-ini-overrides.ini`)
223227

@@ -298,7 +302,7 @@ docker exec -it myapp-php-fpm /bin/bash
298302

299303
and then, inside the container
300304
```bash
301-
composer create-project --prefer-dist cakephp/app:~4.0 .
305+
composer create-project --prefer-dist cakephp/app:5.* .
302306
```
303307
Next, fix the database connection strings by following the steps in [Connecting to your database](#Connecting-to-your-database) (above).
304308

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ services:
4444
working_dir: /var/www/myapp
4545
volumes:
4646
- ../cakephp:/var/www/myapp
47-
- ./php-fpm/php-ini-overrides.ini:/etc/php/7.4/fpm/conf.d/99-overrides.ini
47+
- ./php-fpm/php-ini-overrides.ini:/etc/php/8.1/fpm/conf.d/99-overrides.ini
4848
links:
4949
- myapp-mailhog
5050
- myapp-mysql

php-fpm/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
FROM phpdockerio/php74-fpm:latest
1+
FROM phpdockerio/php:8.1-fpm
2+
WORKDIR "/var/www/myapp"
23

34
# Install selected extensions and other stuff
45
RUN apt-get update \
5-
&& apt-get -y --no-install-recommends install php7.4-mysql php7.4-intl php7.4-mbstring php7.4-sqlite3\
6-
&& apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*
7-
8-
9-
WORKDIR "/var/www/myapp"
6+
&& apt-get -y --no-install-recommends install \
7+
php8.1-intl \
8+
php8.1-mysql \
9+
php8.1-sqlite3 \
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/*

php-fpm/php-ini-overrides.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
upload_max_filesize = 100M
22
post_max_size = 108M
3+
zend.assertions = 1

0 commit comments

Comments
 (0)