Sign inSign up

davidsal/laravel

By davidsal

•Updated almost 7 years ago

Image for latest Laravel on Bitnami/Minideb for rapid development by David Melara

Image
0

113

davidsal/laravel repository overview

⁠Laravel Debian/Container

This is a rapid development container, just run the code below and you are ready to go. You can create a new project or use your existing one.
I do this on my spare time, so if you appreciate my work and want to support me, you can do it via paypal.me

PayPal Donation
  • Minideb: This container is built on top of Debian 10 Buster. PHP and Composer where installed using APT, hence its size.
  • PHP: PHP v7.3.9-1~deb10u1 is installed.
  • Composer: Composer v1.8.4 is installed.
  • Node Version Manager: NVM v0.35.0 is installed.
  • Node: Node LTS v12.13.0 is installed.
  • NPM: NPM v6.12.0 is installed.
  • Laravel: Composer pulls the latest laravel available (Internet needed).
  • Size: About 575MB in size due to letting APT, PHP and Composer cache enabled. Also includes NVM, Node and NPM. This is a rapid development container after all, this allows to create new projects in seconds.
  • Architecture: AMD64. ARM coming soon.
  • Version: 2019.10.26.

⁠How To Use This Image?

Run the next command, replace according your needs. After that, you can use docker start/stop.

Port: This is the port to access your laravel project, ex. 8000,8001,etc. You can access your project by going into localhost:port/

Directory: This is the volume directory for storing your laravel source code. If no project is found, composer will automatically create a new one, leaving you with a "src" directory where all your project files are stored. If you already have a project, then make sure to create a "src" directory inside your volume Directory and copy your existing project there.

Name: This is the name of your container, by giving different ports and names, you can have multiple containers for multiple projects.

docker run -d --tty -p Port:8000 -v Directory:/home/laravel/src --name Name davidsal/laravel

⁠MySQL

Common PHP modules are installed, including the ones for MySQL. If you wish to connect your laravel project to your MySQL DB running on your host, go to your SRC directory and edit your .env file. In my case I'm using a passwordless root user, and MySQL running on another container with the 3306 port exposed :


DB_CONNECTION=mysql
DB_HOST=172.17.0.1
DB_PORT=3306
DB_DATABASE=Your_Database
DB_USERNAME=root
DB_PASSWORD=

Why I'm using 172.17.0.1? Because it is my Gateway IP for docker containers, you can check yours by issuing ifconfig and looking for the docker0 interface. This IP is a direct reference to your HOST IP. I develop on Linux, not sure if this works the same on Windows/Mac.

⁠Tweaking

Access the console: you can access it by issuing the next command:

docker exec -it <Container Name> /bin/bash

Switch to user laravel: php artisan serve is running under user laravel. To use php artisan switch to user laravel and go to /home/laravel/src/src/ This is your project directory.

su laravel
cd /home/laravel/src/src

Entry Script: This is the script being called when starting the container, nano is installed so you can modifiy it easily.

nano /home/laravel/Entry Owner is user laravel!

Auto start on boot: If you need the container to start at machine boot, use the next code. For more restart flags, check the documentation at the next link
Start containers automatically ⁠

docker run -d --tty  --restart always -p Port:8000 -v Directory:/home/laravel/src --name Name davidsal/laravel

Tag summary

Content type

Image

Digest

Size

212.4 MB

Last updated

almost 7 years ago

docker pull davidsal/laravel