Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Merge pull request #18 from sasensi/master
Browse files Browse the repository at this point in the history
Add a way to install with docker
  • Loading branch information
Sandeesh authored Oct 17, 2020
2 parents 8a7a6cb + a72924b commit e45c37c
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .env.example.docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
APP_NAME=Laravel
APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=http://localhost

DB_CONNECTION=mysql
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=db
DB_USERNAME=user
DB_PASSWORD=password

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
QUEUE_DRIVER=sync

# Set the allowed domains for CORS.
# Separate each one by a comma.
# Remove or comment to allow all origins.

CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:4200
8 changes: 8 additions & 0 deletions config/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
'prefix' => '',
'strict' => true,
'engine' => null,
'modes' => [
'ONLY_FULL_GROUP_BY',
'STRICT_TRANS_TABLES',
'NO_ZERO_IN_DATE',
'NO_ZERO_DATE',
'ERROR_FOR_DIVISION_BY_ZERO',
'NO_ENGINE_SUBSTITUTION',
],
],

'pgsql' => [
Expand Down
19 changes: 19 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.1'
services:

php:
build:
context: ./php
volumes:
- ../:/app
working_dir: /app
ports:
- 8000:8000

mysql:
image: mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: db
MYSQL_USER: user
MYSQL_PASSWORD: password
3 changes: 3 additions & 0 deletions docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM php:7.1-fpm

RUN docker-php-ext-install pdo_mysql
21 changes: 21 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ This repo is functionality complete — PRs and issues welcome!

Please check the official laravel installation guide for server requirements before you start. [Official Documentation](https://laravel.com/docs/5.4/installation#installation)

Alternative installation is possible without local dependencies relying on [Docker](#docker).

Clone the repository

Expand Down Expand Up @@ -78,6 +79,26 @@ Run the database seeder and you're done
***Note*** : It's recommended to have a clean database before seeding. You can refresh your migrations at any point to clean the database by running the following command

php artisan migrate:refresh

## Docker

To install with [Docker](https://www.docker.com), run following commands:

```
git clone [email protected]:gothinkster/laravel-realworld-example-app.git
cd laravel-realworld-example-app
cp .env.example.docker .env
docker run -v $(pwd):/app composer install
cd ./docker
docker-compose up -d
docker-compose exec php php artisan key:generate
docker-compose exec php php artisan jwt:generate
docker-compose exec php php artisan migrate
docker-compose exec php php artisan db:seed
docker-compose exec php php artisan serve --host=0.0.0.0
```

The api can be accessed at [http://localhost:8000/api](http://localhost:8000/api).

## API Specification

Expand Down

0 comments on commit e45c37c

Please sign in to comment.