Skip to content

Commit 1f389d3

Browse files
author
José Fernando Cordova
committed
refactor
1 parent 7e1c4ea commit 1f389d3

File tree

6 files changed

+638
-295
lines changed

6 files changed

+638
-295
lines changed

.docker/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
/local-mysql-datadir/
2+
/xdebug.ini

.docker/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ COPY .docker/vhost.conf /etc/apache2/sites-available/000-default.conf
3737
COPY ./composer.json ./composer.json
3838
COPY ./composer.lock ./composer.lock
3939

40+
# entrypoint
41+
COPY .docker/docker-php-entrypoint /usr/local/bin/
42+
4043
# www-data:
4144
RUN chown -R www-data:www-data ./ && a2enmod rewrite
45+
46+
RUN chmod 755 /usr/local/bin/docker-php-entrypoint
47+
RUN chmod 777 -R storage
48+
49+
# mode-root:
4250
USER root

.docker/docker-php-entrypoint

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
#!/bin/bash
2+
3+
# ENVIRONMENT VARIABLES -----------------------------------
4+
5+
cp /docker-laravel-api-dev/.env.example /docker-laravel-api-dev/.env
6+
7+
# Xdebug
8+
9+
if [ "${XDEBUG_MODE}" == 1 ] ; then
10+
echo 'Installing XDebug...'
11+
pecl install xdebug && docker-php-ext-enable xdebug
12+
echo 'XDebug installed!'
13+
fi
14+
15+
# WAIT FOR MYSQL READY -----------------------------------
16+
17+
echo 'Checking MySql...'
18+
while !(mysqladmin ping --host=$DB_HOST)
19+
do
20+
sleep 1
21+
echo 'Waiting for MySql...'
22+
done
23+
echo 'MySql ready!'
24+
25+
# MIGRATIONS -----------------------------------
26+
27+
echo 'Running Migrations...'
28+
cd /docker-laravel-api-dev
29+
composer install
30+
php artisan migrate
31+
echo 'Migrations done!'
32+
33+
34+
# APACHE -----------------------------------
35+
36+
# first arg is `-f` or `--some-option`
37+
if [ "${1#-}" != "$1" ]; then
38+
set -- apache2-foreground "$@"
39+
fi
40+
41+
exec "$@"

.docker/xdebug.ini.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20160303/xdebug.so
2+
3+
xdebug.remote_enable=1
4+
xdebug.remote_host=XXX.XXX.XXX.XXX
5+
xdebug.remote_log="/tmp/xdebug.log"

0 commit comments

Comments
 (0)