Skip to content

Commit d1d73d7

Browse files
author
José Fernando Cordova
committed
update
1 parent 9260934 commit d1d73d7

File tree

3 files changed

+30
-42
lines changed

3 files changed

+30
-42
lines changed

.docker/Dockerfile

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ RUN apt-get -y install libmcrypt-dev libzzip-dev zziplib-bin zlib1g-dev
99

1010
# MySQL client for Initial Tasks
1111
RUN apt-get update &&\
12-
apt-get install -y mysql-client
12+
apt-get install -y mysql-client
1313

1414
# docker-php ext-install:
1515
RUN docker-php-ext-install mcrypt
@@ -50,9 +50,7 @@ RUN chmod 755 /usr/local/bin/docker-php-entrypoint
5050

5151
# mode-root:
5252
USER root
53-
#RUN chmod 777 -R storage
54-
5553

5654
HEALTHCHECK --interval=50s \
5755
--timeout=600s \
58-
CMD curl -f http://localhost/api/hello || exit 1
56+
CMD curl -f http://localhost/api/hello || exit 1

.docker/docker-php-entrypoint

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
#!/bin/bash
22

3-
# ENVIRONMENT VARIABLES -----------------------------------
4-
3+
# ENVIRONMENT VARIABLES ----------------------------------
54
cp /docker-laravel-api-dev/.env.example /docker-laravel-api-dev/.env
65

76
# Xdebug ----------------------------------------------------
8-
97
if [ "${XDEBUG_MODE}" == 1 ] ; then
108
mkdir -p /docker-laravel-api-dev/.docker/local-mysql-datadir
119
echo 'Installs require-dev dependencies'
12-
composer install --no-scripts
10+
composer install --no-scripts
11+
echo 'Permissions'
12+
chmod 777 -R /docker-laravel-api-dev/storage
1313
echo 'Installing XDebug...'
1414
pecl install xdebug && docker-php-ext-enable xdebug
1515
echo 'XDebug installed!'
1616
fi
1717

1818
# WAIT FOR MYSQL READY -----------------------------------
19-
2019
echo 'Checking MySql...'
2120
while !(mysqladmin ping --host=$DB_HOST)
2221
do
@@ -26,7 +25,6 @@
2625
echo 'MySql ready!'
2726

2827
# MIGRATIONS -----------------------------------
29-
3028
echo 'Running Migrations...'
3129
cd /docker-laravel-api-dev
3230
php artisan key:generate
@@ -35,10 +33,8 @@
3533
echo 'Migrations done!'
3634

3735
# APACHE -----------------------------------
38-
3936
# first arg is `-f` or `--some-option`
4037
if [ "${1#-}" != "$1" ]; then
4138
set -- apache2-foreground "$@"
4239
fi
43-
44-
exec "$@"
40+
exec "$@"

README.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,42 @@
88
* MySQL
99
* Xdebug
1010
* Docker
11-
12-
## Docker Environments
1311

14-
### Swarm Mode
15-
Clone this respository and run the following commands:
16-
```bash
17-
cd docker-laravel-api-dev/
18-
# Creating mount folder
19-
mkdir .docker/local-mysql-datadir
20-
docker stack deploy -c docker-compose.yml docker-laravel-api-dev
21-
# wait for it and follow the docker instructions!...
22-
```
23-
### Docker Compose
24-
Clone this respository and run the following commands:
25-
```bash
26-
cd docker-laravel-api-dev/
27-
docker-compose -f docker-compose.yml up --build -d
28-
# wait for it to build!...
29-
```
30-
### PWD
31-
With Play with Docker and following the docker instructions, it is easy to deploy and test this environment!
12+
### Environments
3213

33-
[![Try in PWD](https://cdn.rawgit.com/play-with-docker/stacks/cff22438/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/jfernancordova/docker-laravel-api-dev/feature/refactoring/docker-compose-pwd.yml)
14+
* docker-compose-dev.yml: generate automatically folders and require-dev dependencies on your local workspace including Xdebug, however the yaml file has a key called:
15+
"XDEBUG_MODE", this yaml by default has the value true (1) to install it.
3416

35-
## Docker Instructions
17+
* docker-compose-pwd.yml: you can use it in [![Play With Docker](https://cdn.rawgit.com/play-with-docker/stacks/cff22438/assets/images/button.png)](http://play-with-docker.com?stack=https://raw.githubusercontent.com/jfernancordova/docker-laravel-api-dev/feature/refactoring/docker-compose-pwd.yml), to visualize this environment and test it, however you should see the container lists to verify the HEALTHCHECK.
3618

37-
In the root directory:
3819
```bash
3920
# container lists
4021
docker ps
4122
# make sure that the docker dockerlaravelapidev_php_1 or php container is (healthy),
42-
normally the process begins in starting mode (2 or 3 minutes)
23+
normally the process begins in starting mode (health: starting),
4324
```
4425

45-
### Environments
26+
* docker-compose-prod.yml: if you are going to use this yaml, make sure to generate the migrations before!, however you can modify the entrypoint to generate them.
4627

47-
* docker-compose-dev.yml: generate automatically severals folders and require-dev dependencies on your local. (Including Xdebug).
48-
49-
* docker-compose-pwd.yml: you can use it in play with docker and test its process.
28+
## Docker Environments
5029

51-
* docker-compose-prod.yml: if you are going to use this yaml, make sure to generate the migrations before, however you can modify the entrypoint.
30+
### Swarm Mode
31+
Clone this respository and run the following commands:
32+
```bash
33+
cd docker-laravel-api-dev/
34+
docker stack deploy -c docker-compose-dev.yml docker-laravel-api-dev
35+
# wait for the HEALTHCHECK in healthy mode
36+
```
5237

38+
### Docker Compose
39+
Clone this respository and run the following commands:
40+
```bash
41+
cd docker-laravel-api-dev/
42+
docker-compose -f docker-compose-dev.yml up --build -d
43+
or to see the logs
44+
docker-compose -f docker-compose-dev.yml up
45+
# wait for the HEALTHCHECK in healthy mode
46+
```
5347

5448
### API Boilerplate Reference
5549
https://github.com/francescomalatesta/laravel-api-boilerplate-jwt/blob/master/readme.md

0 commit comments

Comments
 (0)