Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 8b18200

Browse files
committed
Merge branch 'master' of github.com:eduwass/docker-nginx-php-git
* 'master' of github.com:eduwass/docker-nginx-php-git: gitignore attribution Added docker-hook proxy feature
2 parents 29007bd + e190fca commit 8b18200

File tree

5 files changed

+51
-30
lines changed

5 files changed

+51
-30
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.idea

‎README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The following flags are a list of all the currently supported options that can b
2222
- **PHP_UPLOAD_MAX_FILESIZE** : Set a larger upload_max_filesize, default is 100 Mb
2323
- **DOMAIN** : Set domain name for Lets Encrypt scripts
2424
- **GIT_HOOK_TOKEN** : Auth-Token used for the [docker-hook](https://github.com/schickling/docker-hook) listener
25+
- **DOCKER_HOOK_PROXY** : Set to 1 to enable `/docker-hook` as an endpoint on your nginx site
2526

2627

2728
### Dynamically Pulling code from git
@@ -68,6 +69,8 @@ You'll need some extra ENV vars to enable this feature. These are ```GIT_EMAIL``
6869

6970
All you have to do is setup the **GIT_HOOK_TOKEN** env var, and any requests to `http://yourdomain:8555/<GIT_HOOK_TOKEN>` will trigger a Git pull
7071

72+
You can also enable docker-hook on your default nginx ports with **DOCKER_HOOK_PROXY**. If enabled, you can POST your github webhook to `http(s)://yourdomain/docker-hook/<GIT_HOOK_TOKEN>` without using port 8555.
73+
7174
More info on how it works here: [schickling/docker-hook](https://github.com/schickling/docker-hook)
7275

7376
### Push code to Git
@@ -119,6 +122,7 @@ docker logs <CONTAINER_NAME>
119122
```
120123

121124
## Thanks to
125+
* [eduwass/docker-nginx-php-git](https://github.com/eduwass/docker-nginx-php-git) - Enhanced docker image with docker hook
122126
* [ngineered/nginx-php-fpm](https://github.com/ngineered/nginx-php-fpm) - Base Docker image and Git push/pull functionalities
123127
* [schickling/docker-hook](https://github.com/schickling/docker-hook) - Git Webhook listener
124128

‎conf/nginx-site-ssl.conf

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

77
# Make site accessible from http://localhost/
8-
server_name _;
9-
ssl_certificate /etc/letsencrypt/live/##DOMAIN##/fullchain.pem;
10-
ssl_certificate_key /etc/letsencrypt/live/##DOMAIN##/privkey.pem;
11-
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
12-
ssl_ciphers HIGH:!aNULL:!MD5;
8+
server_name _;
9+
ssl_certificate /etc/letsencrypt/live/##DOMAIN##/fullchain.pem;
10+
ssl_certificate_key /etc/letsencrypt/live/##DOMAIN##/privkey.pem;
11+
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
12+
ssl_ciphers HIGH:!aNULL:!MD5;
1313

1414
# Make site accessible from http://localhost/
1515
server_name _;
16-
16+
1717
# Disable sendfile as per https://docs.vagrantup.com/v2/synced-folders/virtualbox.html
1818
sendfile off;
1919

2020
# Add stdout logging
21-
2221
error_log /dev/stdout info;
2322
access_log /dev/stdout;
2423

@@ -28,6 +27,12 @@ server {
2827
try_files $uri $uri/ /index.php?q=$uri&$args;
2928
}
3029

30+
# Create a docker-hook folder which proxies to docker-hook
31+
location /docker-hook {
32+
rewrite ^/docker-hook(.*) /1ドル break;
33+
proxy_pass http://127.0.0.1:8555;
34+
}
35+
3136
#error_page 404 /404.html;
3237

3338
# redirect server error pages to the static page /50x.html
@@ -40,29 +45,28 @@ server {
4045
# pass the PHP scripts to FastCGI server listening on socket
4146
#
4247
location ~ \.php$ {
43-
try_files $uri =404;
48+
try_files $uri =404;
4449
fastcgi_split_path_info ^(.+\.php)(/.+)$;
4550
fastcgi_pass unix:/var/run/php-fpm.sock;
4651
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
47-
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
52+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
4853
fastcgi_index index.php;
4954
include fastcgi_params;
5055
}
5156

52-
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
53-
expires 5d;
54-
}
57+
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
58+
expires 5d;
59+
}
5560

5661
# deny access to . files, for security
5762
#
5863
location ~ /\. {
59-
log_not_found off;
60-
deny all;
64+
log_not_found off;
65+
deny all;
6166
}
6267

63-
location ^~ /.well-known {
64-
allow all;
65-
auth_basic off;
66-
}
67-
68+
location ^~ /.well-known {
69+
allow all;
70+
auth_basic off;
71+
}
6872
}

‎conf/nginx-site.conf

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ server {
2222
try_files $uri $uri/ /index.php?q=$uri&$args;
2323
}
2424

25+
# Create a docker-hook folder which proxies to docker-hook
26+
location /docker-hook {
27+
rewrite ^/docker-hook(.*) /1ドル break;
28+
proxy_pass http://127.0.0.1:8555;
29+
}
30+
2531
#error_page 404 /404.html;
2632

2733
# redirect server error pages to the static page /50x.html
@@ -34,29 +40,29 @@ server {
3440
# pass the PHP scripts to FastCGI server listening on socket
3541
#
3642
location ~ \.php$ {
37-
try_files $uri =404;
43+
try_files $uri =404;
3844
fastcgi_split_path_info ^(.+\.php)(/.+)$;
3945
fastcgi_pass unix:/var/run/php-fpm.sock;
4046
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
41-
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
47+
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
4248
fastcgi_index index.php;
4349
include fastcgi_params;
4450
}
4551

46-
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
47-
expires 5d;
48-
}
52+
location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ {
53+
expires 5d;
54+
}
4955

5056
# deny access to . files, for security
5157
#
5258
location ~ /\. {
53-
log_not_found off;
54-
deny all;
59+
log_not_found off;
60+
deny all;
5561
}
5662

57-
location ^~ /.well-known {
58-
allow all;
59-
auth_basic off;
60-
}
63+
location ^~ /.well-known {
64+
allow all;
65+
auth_basic off;
66+
}
6167

6268
}

‎scripts/start.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ else
6363
sed -i "s/expose_php = On/expose_php = Off/g" /etc/php7/conf.d/php.ini
6464
fi
6565

66+
# Enable proxy for Docker-Hook at /docker-hook/
67+
if [[ "$DOCKER_HOOK_PROXY" != "1" ]] ; then
68+
sed -i '/location \/docker-hook/,/.*\}/d' /etc/nginx/sites-available/default.conf
69+
sed -i '/location \/docker-hook/,/.*\}/d' /etc/nginx/sites-available/default-ssl.conf
70+
fi
71+
6672
# Increase the memory_limit
6773
if [ ! -z "$PHP_MEM_LIMIT" ]; then
6874
sed -i "s/memory_limit = 128M/memory_limit = ${PHP_MEM_LIMIT}M/g" /etc/php7/conf.d/php.ini

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /