Skip to content

Commit 66f6bf4

Browse files
authored
Merge upstream (#5)
1 parent e6a14e6 commit 66f6bf4

File tree

6 files changed

+44
-18
lines changed

6 files changed

+44
-18
lines changed

.docker/nginx/default.conf

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ server {
55
index index.php;
66

77
location / {
8-
try_files $uri /index.php?$args;
8+
try_files $uri $uri/ /index.php?$args;
99
}
1010

1111
location ~ \.php$ {
12+
try_files $uri =404;
13+
include fastcgi_params;
1214
fastcgi_pass php:9000;
1315
fastcgi_index index.php;
16+
fastcgi_intercept_errors on;
1417
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
15-
fastcgi_buffers 16 16k;
16-
fastcgi_buffer_size 32k;
17-
include fastcgi_params;
1818
}
19-
}
19+
}

.docker/php/docker-entrypoint.sh

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,28 @@ if [ "$1" = 'php-fpm' ] || [ "$1" = 'php' ] || [ "$1" = 'bin/cakephp' ]; then
4343
bin/cake mixerapi install --auto Y
4444
fi
4545

46+
echo "ENV: $APP_ENV"
4647
if [ "$APP_ENV" != 'prod' ]; then
4748
composer install --prefer-dist --no-interaction
4849
fi
4950

5051
mkdir -p logs tmp
51-
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX logs
52-
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX tmp
53-
setfacl -R -m g:nginx:rwX /srv/app
52+
53+
echo "HOST OS: $HOST_OS"
54+
if [[ $HOST_OS == *"Linux"* ]]; then
55+
echo "Setting ACLs..."
56+
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX logs
57+
setfacl -R -m u:www-data:rwX -m u:"$(whoami)":rwX tmp
58+
setfacl -R -m g:nginx:rwX /srv/app
59+
fi
60+
61+
echo "setting ownership..."
5462
chown -R cakephp:www-data .
63+
64+
echo "setting permissions..."
5565
chmod 774 -R .
66+
67+
echo "waiting for fpm..."
5668
fi
5769

5870
exec docker-php-entrypoint "$@"

.github/workflows/image.yml.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
name: Image
22

3-
on:
4-
create:
5-
tags:
6-
- "v*.*.*"
3+
#on:
4+
# create:
5+
# tags:
6+
# - "v*.*.*"
77

88
jobs:
99
build:

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ FROM cnizzardini/php-fpm-alpine:8.0-latest AS cakephp_php
66

77
ARG ENV=prod
88
ARG UID=1000
9+
ARG HOST_OS=Linux
910
ENV APP_ENV=$ENV
11+
ENV HOST_OS=$HOST_OS
1012

1113
#
1214
# dev/test depdencies

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
SHELL=/bin/bash
1+
SHELL := /bin/bash # set shell based on host os, use /bin/zsh for mac
22
.DEFAULT_GOAL := help
33

44
#
@@ -107,12 +107,12 @@ help:
107107
init: do.copy
108108
@printf $(DOCKER_ICO) && printf "$(GOOD)running docker build and up $(E)"
109109
@mkdir -p app && touch app/.gitkeep
110-
@docker-compose build --build-arg UID=$(shell id -u) --build-arg ENV=dev
110+
@docker-compose build --build-arg UID=$(shell id -u) --build-arg ENV=dev --build-arg HOST_OS=$(shell uname -s)
111111
@$(DC_UP)
112112
init.nocache: do.copy
113113
@printf $(DOCKER_ICO) && printf "$(GOOD)running docker build --no-cache and up $(E)"
114114
@mkdir -p app && touch app/.gitkeep
115-
@docker-compose build --build-arg UID=$(shell id -u) --build-arg ENV=dev --no-cache
115+
@docker-compose build --build-arg UID=$(shell id -u) --build-arg ENV=dev --no-cache --build-arg HOST_OS=$(shell uname -s)
116116
@$(DC_UP)
117117

118118
#

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,26 @@ based on the official [cakephp/app 4.2](https://github.com/cakephp/app) template
1414

1515
This project has been forked from [cnizzardini/cakephp-docker](https://github.com/cnizzardini/cakephp-docker).
1616

17+
#### Dependencies:
18+
19+
- [Docker 20](https://docs.docker.com/engine/release-notes/) or higher
20+
- Make
21+
1722
| Service | Host:Port | Docker Host | Image |
1823
| ----------- | ----------- | ----------- | ----------- |
19-
| PHP7.4-FPM w/ Xdebug 3 | - | php | [cnizzardini/php-fpm-alpine:7.4-latest](https://hub.docker.com/r/cnizzardini/php-fpm-alpine) |
24+
| PHP8.0-FPM w/ Xdebug 3 | - | php | [cnizzardini/php-fpm-alpine:8.0-latest](https://hub.docker.com/r/cnizzardini/php-fpm-alpine) |
2025
| NGINX 1.19 | localhost:8080 | web | [nginx:1.19-alpine](https://hub.docker.com/_/nginx) |
2126
| MySQL 8 | localhost:3607 | db | [library/mysql:8](https://hub.docker.com/_/mysql) |
2227

28+
2329
- [Installation](#installation)
24-
- [Mac OS Notes](#mac-notes)
30+
- [MacOS Notes](#mac-notes)
2531
- [Usage](#usage)
2632
- [PHP](#php)
2733
- [MySQL](#mysql)
2834
- [NGINX](#nginx)
2935
- [Xdebug](#xdebug)
36+
- [Reinstall](#reinstall)
3037

3138
## Installation
3239

@@ -146,4 +153,9 @@ Go to `File > Settings > Languages & Frameworks > PHP > Servers`
146153
- Debugger: `Xdebug`
147154
- Use path mappings: `Enable`
148155

149-
Map your projects app directory to the absolute path on the docker container `/srv/app`
156+
Map your project's app directory to the absolute path on the docker container `/srv/app`
157+
158+
## Reinstall
159+
160+
To completely reinstall delete existing containers and images, then remove the `app/` directory and run `make init`
161+
again.

0 commit comments

Comments
 (0)