From 9a954ddb88e22433c7b1250930638d11811cc3b4 Mon Sep 17 00:00:00 2001 From: Jack Goh Date: Wed, 11 Jul 2018 12:38:09 +0800 Subject: [PATCH] fix docker config to wait until db start only start server --- Dockerfile | 17 ++++---- database/seeds/CompanySeeder.php | 2 +- database/seeds/ContactSeeder.php | 16 ++++++++ docker-compose.yml | 31 ++++++++------- readme.md | 68 +++++++++----------------------- start.sh | 3 -- wait.sh | 16 ++++++++ 7 files changed, 77 insertions(+), 76 deletions(-) create mode 100644 database/seeds/ContactSeeder.php delete mode 100644 start.sh create mode 100644 wait.sh diff --git a/Dockerfile b/Dockerfile index 1db0872..9efcd1c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,13 @@ -FROM php:7 -RUN apt-get update -y && apt-get install -y openssl zip unzip git netcat libpng-dev +FROM php:7.1.3 +RUN apt-get update -y && apt-get install -y openssl zip unzip git zlib1g-dev netcat mysql-client libgd-dev libfreetype6-dev libjpeg62-turbo-dev libpng12-dev RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer -RUN docker-php-ext-install pdo pdo_mysql -RUN docker-php-ext-install gd +RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/ +RUN docker-php-ext-install pdo pdo_mysql zip gd WORKDIR /app COPY . /app -RUN composer update -ADD start.sh /start.sh -CMD ["/start.sh"] +RUN composer install + +COPY wait.sh /usr/local/bin/wait.sh +RUN chmod +x /usr/local/bin/wait.sh +CMD /usr/local/bin/wait.sh && composer dumpautoload && php artisan storage:link && php artisan migrate && php artisan db:seed && php artisan serve --host=0.0.0.0 --port=8000 +EXPOSE 8000 diff --git a/database/seeds/CompanySeeder.php b/database/seeds/CompanySeeder.php index b35e062..64123e4 100644 --- a/database/seeds/CompanySeeder.php +++ b/database/seeds/CompanySeeder.php @@ -12,8 +12,8 @@ class CompanySeeder extends Seeder */ public function run() { + DB::table('companies')->truncate(); DB::table('companies')->insert([ - 'id' => '999', 'company_name'=>'testing', 'registration_no'=>'testing', diff --git a/database/seeds/ContactSeeder.php b/database/seeds/ContactSeeder.php new file mode 100644 index 0000000..03c0a54 --- /dev/null +++ b/database/seeds/ContactSeeder.php @@ -0,0 +1,16 @@ +

+# IZYIM (Easy Import) + +> A system for importer to place shipping order and freight forwarder to manage the process from receiving shipping order, warehouse receive process, custom declaration until delivery scheduling to the importer address.

-Build Status -Total Downloads -Latest Stable Version -License +

-## About Laravel +## TechStack -Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experience to be truly fulfilling. Laravel attempts to take the pain out of development by easing common tasks used in the majority of web projects, such as: +- Laravel 5.6 +- Docker compose +- HTML, CSS, Jquery +- Authentication with JWT -- [Simple, fast routing engine](https://laravel.com/docs/routing). -- [Powerful dependency injection container](https://laravel.com/docs/container). -- Multiple back-ends for [session](https://laravel.com/docs/session) and [cache](https://laravel.com/docs/cache) storage. -- Expressive, intuitive [database ORM](https://laravel.com/docs/eloquent). -- Database agnostic [schema migrations](https://laravel.com/docs/migrations). -- [Robust background job processing](https://laravel.com/docs/queues). -- [Real-time event broadcasting](https://laravel.com/docs/broadcasting). +## Installation -Laravel is accessible, yet powerful, providing tools needed for large, robust applications. +- `git clone git@gitlab.com:CIEFWorldwideSdnBhd/izyim-api.git` +- Copy `.env-example` to `.env` +- Edit `.env` and set your database connection details +- Run `docker-compose up` -## Learning Laravel +## Usage +TBD -Laravel has the most extensive and thorough [documentation](https://laravel.com/docs) and video tutorial library of any modern web application framework, making it a breeze to get started learning the framework. - -If you're not in the mood to read, [Laracasts](https://laracasts.com) contains over 1100 video tutorials on a range of topics including Laravel, modern PHP, unit testing, JavaScript, and more. Boost the skill level of yourself and your entire team by digging into our comprehensive video library. - -## Laravel Sponsors - -We would like to extend our thanks to the following sponsors for helping fund on-going Laravel development. If you are interested in becoming a sponsor, please visit the Laravel [Patreon page](https://patreon.com/taylorotwell): - -- **[Vehikl](https://vehikl.com/)** -- **[Tighten Co.](https://tighten.co)** -- **[Kirschbaum Development Group](https://kirschbaumdevelopment.com)** -- **[British Software Development](https://www.britishsoftware.co)** -- [Fragrantica](https://www.fragrantica.com) -- [SOFTonSOFA](https://softonsofa.com/) -- [User10](https://user10.com) -- [Soumettre.fr](https://soumettre.fr/) -- [CodeBrisk](https://codebrisk.com) -- [1Forge](https://1forge.com) -- [TECPRESSO](https://tecpresso.co.jp/) -- [Pulse Storm](http://www.pulsestorm.net/) -- [Runtime Converter](http://runtimeconverter.com/) -- [WebL'Agence](https://weblagence.com/) - -## Contributing - -Thank you for considering contributing to the Laravel framework! The contribution guide can be found in the [Laravel documentation](https://laravel.com/docs/contributions). - -## Security Vulnerabilities - -If you discover a security vulnerability within Laravel, please send an e-mail to Taylor Otwell via [taylor@laravel.com](mailto:taylor@laravel.com). All security vulnerabilities will be promptly addressed. - -## License - -The Laravel framework is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT). +#### Test Credentials +TBD diff --git a/start.sh b/start.sh deleted file mode 100644 index b41ad39..0000000 --- a/start.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -while ! nc -z db 3306; do sleep 3; done -php artisan db:seed && php artisan serve --host=0.0.0.0 --port=8000 \ No newline at end of file diff --git a/wait.sh b/wait.sh new file mode 100644 index 0000000..60ec004 --- /dev/null +++ b/wait.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +HOST="mysql" +PORT="3306" +USER="default" +PASSWORD="secret" +DATABASE="default" + +echo "Waiting for mysql" +until nc -w 1 -z mysql 3306 &> /dev/null +do + printf "." + sleep 1 +done + +echo -e "\nmysql ready"