Skip to content

Commit 68ed7d7

Browse files
committed
Merge branch 'release/0.11.0'
2 parents e223dc4 + 0b18b87 commit 68ed7d7

File tree

13 files changed

+70
-83
lines changed

13 files changed

+70
-83
lines changed

Dockerfile

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
1-
FROM php:7.4.8-fpm-alpine3.11
1+
FROM php:7.4.9-fpm-alpine3.11
22

33
ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
44
PHP_OPCACHE_MAX_ACCELERATED_FILES="10000" \
55
PHP_OPCACHE_MEMORY_CONSUMPTION="192" \
66
PHP_OPCACHE_MAX_WASTED_PERCENTAGE="10" \
7-
PHP_MEMORY_LIMIT="512M"
7+
PHP_MEMORY_LIMIT="512M" \
8+
PHP_MAX_EXECUTION_TIME="60"
89

910
RUN apk info \
1011
&& echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
1112
&& echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
12-
&& echo @3.9 http://dl-cdn.alpinelinux.org/alpine/v3.9/main >> /etc/apk/repositories \
13-
&& echo @3.10 http://dl-cdn.alpinelinux.org/alpine/v3.10/main >> /etc/apk/repositories \
1413
&& apk update \
1514
&& apk upgrade \
1615
&& apk add --no-cache --virtual .build-deps \
@@ -37,9 +36,6 @@ RUN apk info \
3736
php7-dom \
3837
mysql-client \
3938
yarn@edge \
40-
xvfb \
41-
chromium@3.9 \
42-
chromium-chromedriver@3.9 \
4339
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
4440
&& docker-php-ext-install -j$(nproc) \
4541
gd \
@@ -66,11 +62,6 @@ ENV LD_PRELOAD /usr/lib/preloadable_libiconv.so php
6662
# change default shell
6763
SHELL ["/bin/bash", "-c"]
6864

69-
# create app user
70-
RUN addgroup -S app && \
71-
adduser -S app -G app && \
72-
echo "app ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
73-
7465
# create working dir
7566
RUN mkdir /opt/app
7667
WORKDIR /opt/app
@@ -103,13 +94,11 @@ RUN composer global require hirak/prestissimo
10394
RUN yarn config set strict-ssl false && \
10495
yarn global add cross-env
10596

106-
# copy home folder and make run scripts executable
107-
COPY ./home/app/ /home/app/
108-
COPY ./root/.bashrc /root/
109-
RUN find /home/app -name "run-*.sh" -exec chmod -v +x {} \;
110-
RUN chmod +x /home/app/entrypoint.sh
97+
# copy root folder and make run scripts executable
98+
COPY ./root/ /root/
99+
RUN find /root -name "*.sh" -exec chmod -v +x {} \;
111100

112101
# run the application
113-
ENTRYPOINT ["/home/app/entrypoint.sh"]
114-
CMD /home/app/run-prod.sh
102+
ENTRYPOINT ["/root/entrypoint.sh"]
103+
CMD ["runsvdir", "/etc/service"]
115104
EXPOSE 8080

README.md

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,14 @@ version: '3.7'
4545
services:
4646
app:
4747
build: .
48-
command: /home/app/run-dev.sh
4948
restart: unless-stopped
5049
environment:
5150
- PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
5251
- PHP_MEMORY_LIMIT=1G
52+
- PHP_MAX_EXECUTION_TIME=30
53+
- STARTUP_COMMAND1=/root/modules/dev.sh
54+
- STARTUP_COMMAND2=php artisan migrate --force
55+
- STARTUP_COMMAND3=php artisan setup
5356
volumes:
5457
- ./:/opt/app:cached
5558
ports:
@@ -80,13 +83,15 @@ version: '3.7'
8083
services:
8184
app:
8285
image: sourceboat/docker-laravel
83-
command: /home/app/run-prod.sh
8486
restart: unless-stopped
8587
environment:
8688
- PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
8789
- PHP_MEMORY_LIMIT=1G
88-
- STARTUP_COMMAND1=php artisan migrate --force
89-
- STARTUP_COMMAND2=php artisan horizon:restart
90+
- PHP_MAX_EXECUTION_TIME=30
91+
- STARTUP_COMMAND1=/root/modules/storage.sh
92+
- STARTUP_COMMAND2=/root/modules/cache.sh
93+
- STARTUP_COMMAND3=php artisan migrate --force
94+
- STARTUP_COMMAND4=php artisan horizon:restart
9095
volumes:
9196
- ./:/opt/app:cached
9297
ports:

etc/nginx/conf.d/default.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,6 @@ server {
2929
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
3030
fastcgi_param PATH_INFO $fastcgi_path_info;
3131
fastcgi_param HTTPS $is_https;
32+
fastcgi_hide_header X-Powered-By;
3233
}
3334
}

etc/nginx/nginx.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ http {
1414
include /etc/nginx/mime.types;
1515
default_type application/octet-stream;
1616

17+
server_tokens off;
18+
1719
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
1820
'$status $body_bytes_sent "$http_referer" '
1921
'"$http_user_agent" "$http_x_forwarded_for"';

home/app/.bashrc

Lines changed: 0 additions & 17 deletions
This file was deleted.

home/app/run-dev.sh

Lines changed: 0 additions & 17 deletions
This file was deleted.

home/app/run-prod.sh

Lines changed: 0 additions & 18 deletions
This file was deleted.

root/.bashrc

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,17 @@
1-
source /home/app/.bashrc
1+
# useful aliases
2+
alias ll='ls -la'
3+
alias artisan="php artisan"
4+
5+
# prompt colors and short user display
6+
force_color_prompt=yes
7+
PS1='\[\033[1;36m\]\u\[\033[1;31m\]\[\033[1;32m\]:\[\033[1;35m\]\w\[\033[1;31m\]\$\[\033[0m\] '
8+
9+
# artisan autocompletion
10+
_artisan()
11+
{
12+
COMP_WORDBREAKS=${COMP_WORDBREAKS//:}
13+
COMMANDS=`artisan --raw --no-ansi list | sed "s/[[:space:]].*//g"`
14+
COMPREPLY=(`compgen -W "$COMMANDS" -- "${COMP_WORDS[COMP_CWORD]}"`)
15+
return 0
16+
}
17+
complete -F _artisan artisan

home/app/entrypoint.sh renamed to root/entrypoint.sh

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,12 @@ touch /opt/app/storage/logs/worker.log
1010
chown www-data:www-data -R /opt/app/storage
1111
chown www-data:www-data -R /opt/app/bootstrap/cache
1212

13-
cd /opt/app
14-
15-
# create storage symlink
16-
echo "create storage symlink..."
17-
su www-data -s /bin/sh -c "php artisan storage:link -q"
18-
1913
# startup commands
14+
echo "Running startup commands..."
2015
php /usr/local/bin/startup-commands.php | bash
2116

17+
if [[ -n "$DB_HOST" || -n "$DB_PORT" ]]; then
18+
wait-for-it.sh --host=$DB_HOST --port=$DB_PORT
19+
fi
20+
2221
exec "$@"

root/modules/cache.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env bash
2+
3+
cd /opt/app
4+
5+
# build caches
6+
echo "Build caches..."
7+
php artisan config:cache
8+
php artisan route:cache
9+
php artisan view:cache

root/modules/dev.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
cd /opt/app
3+
4+
echo "Build development..."
5+
composer install --prefer-dist --no-progress --no-interaction
6+
yarn

root/modules/storage.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/usr/bin/env bash
2+
cd /opt/app
3+
4+
echo "Create storage symlink..."
5+
su www-data -s /bin/sh -c "php artisan storage:link -q"

usr/local/etc/php/php.ini

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
; Resource Limits ;
55
;;;;;;;;;;;;;;;;;;;
66

7-
max_execution_time = 60
7+
max_execution_time = ${PHP_MAX_EXECUTION_TIME}
88
max_input_time = 60
99
memory_limit = ${PHP_MEMORY_LIMIT}
1010

@@ -56,3 +56,10 @@ opcache.memory_consumption=${PHP_OPCACHE_MEMORY_CONSUMPTION}
5656
opcache.max_wasted_percentage=${PHP_OPCACHE_MAX_WASTED_PERCENTAGE}
5757
opcache.interned_strings_buffer=16
5858
opcache.fast_shutdown=1
59+
60+
;;;;;;;;;;;;;;;;;
61+
; Miscellaneous ;
62+
;;;;;;;;;;;;;;;;;
63+
64+
; http://www.php.net/manual/en/ini.core.php#ini.expose-php
65+
expose_php = Off

0 commit comments

Comments
 (0)