Skip to content

Commit 629764c

Browse files
authored
Merge branch 'develop' into feature/32-add-max-execution-time-environment-variable
2 parents e7fd4f1 + 73fce5e commit 629764c

File tree

8 files changed

+35
-54
lines changed

8 files changed

+35
-54
lines changed

Dockerfile

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
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" \
@@ -10,8 +10,6 @@ ENV PHP_OPCACHE_VALIDATE_TIMESTAMPS="0" \
1010
RUN apk info \
1111
&& echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories \
1212
&& echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories \
13-
&& echo @3.9 http://dl-cdn.alpinelinux.org/alpine/v3.9/main >> /etc/apk/repositories \
14-
&& echo @3.10 http://dl-cdn.alpinelinux.org/alpine/v3.10/main >> /etc/apk/repositories \
1513
&& apk update \
1614
&& apk upgrade \
1715
&& apk add --no-cache --virtual .build-deps \
@@ -38,9 +36,6 @@ RUN apk info \
3836
php7-dom \
3937
mysql-client \
4038
yarn@edge \
41-
xvfb \
42-
chromium@3.9 \
43-
chromium-chromedriver@3.9 \
4439
&& docker-php-ext-configure gd --with-freetype --with-jpeg \
4540
&& docker-php-ext-install -j$(nproc) \
4641
gd \
@@ -101,10 +96,9 @@ RUN yarn config set strict-ssl false && \
10196

10297
# copy root folder and make run scripts executable
10398
COPY ./root/ /root/
104-
RUN find /root -name "run-*.sh" -exec chmod -v +x {} \;
105-
RUN chmod +x /root/entrypoint.sh
99+
RUN find /root -name "*.sh" -exec chmod -v +x {} \;
106100

107101
# run the application
108102
ENTRYPOINT ["/root/entrypoint.sh"]
109-
CMD /root/run-prod.sh
103+
CMD ["runsvdir", "/etc/service"]
110104
EXPOSE 8080

README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,14 @@ version: '3.7'
4545
services:
4646
app:
4747
build: .
48-
command: /root/run-dev.sh
4948
restart: unless-stopped
5049
environment:
5150
- PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
5251
- PHP_MEMORY_LIMIT=1G
5352
- 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
5456
volumes:
5557
- ./:/opt/app:cached
5658
ports:
@@ -81,14 +83,15 @@ version: '3.7'
8183
services:
8284
app:
8385
image: sourceboat/docker-laravel
84-
command: /root/run-prod.sh
8586
restart: unless-stopped
8687
environment:
8788
- PHP_OPCACHE_VALIDATE_TIMESTAMPS=1
8889
- PHP_MEMORY_LIMIT=1G
8990
- PHP_MAX_EXECUTION_TIME=30
90-
- STARTUP_COMMAND1=php artisan migrate --force
91-
- STARTUP_COMMAND2=php artisan horizon:restart
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
9295
volumes:
9396
- ./:/opt/app:cached
9497
ports:

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"

root/run-dev.sh

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

root/run-prod.sh

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

0 commit comments

Comments
 (0)