Skip to content

Commit e9af2a4

Browse files
committed
Merge branch 'master' of https://github.com/LaraDock/laradock
* 'master' of https://github.com/LaraDock/laradock: Fix typo in README: Giude -> Guide Added laravel cronjob Added cron files copying to workspace crontab Remove port fowarding for MySQL and MariaDB Added NVM binaries in root bashrc
2 parents d0dea21 + 942d1cf commit e9af2a4

4 files changed

Lines changed: 30 additions & 5 deletions

File tree

README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ It's like Laravel Homestead but for Docker instead of Vagrant.
6060
- [Production](#Production)
6161
- [Setup Laravel and Docker on Digital Ocean](#Digital-Ocean)
6262
- [Misc](#Misc)
63+
- [Cron jobs](#CronJobs)
6364
- [Use custom Domain](#Use-custom-Domain)
6465
- [Enable Global Composer Build Install](#Enable-Global-Composer-Build-Install)
6566
- [Install Prestissimo](#Install-Prestissimo)
@@ -924,7 +925,7 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the
924925
<a name="Digital-Ocean"></a>
925926
### Setup Laravel and Docker on Digital Ocean
926927

927-
####[Full Giude Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
928+
####[Full Guide Here](https://github.com/LaraDock/laradock/blob/master/_guides/digital_ocean.md)
928929

929930

930931

@@ -936,6 +937,19 @@ To controll the behavior of xDebug (in the `php-fpm` Container), you can run the
936937

937938

938939
<br>
940+
941+
<a name="CronJobs"></a>
942+
### Adding cron jobs
943+
944+
You can add your cron jobs to `workspace/crontab/root` after the `php artisan` line.
945+
946+
```
947+
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1
948+
949+
# Custom cron
950+
* * * * * root echo "Every Minute" > /var/log/cron.log 2>&1
951+
```
952+
939953
<a name="Use-custom-Domain"></a>
940954
### Use custom Domain (instead of the Docker IP)
941955

docker-compose.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,6 @@ services:
104104
build: ./mysql
105105
volumes_from:
106106
- volumes_data
107-
ports:
108-
- "3306:3306"
109107
environment:
110108
MYSQL_DATABASE: homestead
111109
MYSQL_USER: homestead
@@ -131,8 +129,6 @@ services:
131129
build: ./mariadb
132130
volumes_from:
133131
- volumes_data
134-
ports:
135-
- "3306:3306"
136132
environment:
137133
MYSQL_DATABASE: homestead
138134
MYSQL_USER: homestead

workspace/Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,14 @@ RUN if [ ${INSTALL_NODE} = true ]; then \
165165
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
166166
;fi
167167

168+
# Add NVM binaries to root's .bashrc
169+
USER root
170+
RUN if [ ${INSTALL_NODE} = true ]; then \
171+
echo "" >> ~/.bashrc && \
172+
echo 'export NVM_DIR="/home/laradock/.nvm"' >> ~/.bashrc && \
173+
echo '[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm' >> ~/.bashrc \
174+
;fi
175+
168176
#####################################
169177
# PHP Aerospike:
170178
#####################################
@@ -190,6 +198,12 @@ RUN if [ ${INSTALL_AEROSPIKE_EXTENSION} = false ]; then \
190198
rm /etc/php/7.0/cli/conf.d/aerospike.ini \
191199
;fi
192200

201+
#####################################
202+
# Crontab
203+
#####################################
204+
USER root
205+
COPY ./crontab /var/spool/cron/crontabs
206+
193207
#
194208
#--------------------------------------------------------------------------
195209
# Final Touch

workspace/crontab/root

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* * * * * php /var/www/laravel/artisan schedule:run >> /dev/null 2>&1

0 commit comments

Comments
 (0)