GithubHelp home page GithubHelp logo

devsoli / docker-laravel Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 70 KB

This repository helps you set up your Laravel projects using Docker.

Dockerfile 0.55% PHP 57.85% JavaScript 0.33% Blade 41.27%
docker docker-compose laravel php

docker-laravel's Introduction

docker-laravel

This repository helps you set up your Laravel projects using Docker, even if you are not familiar with Docker.

Services list

  • laravel app
  • nginx web server
  • mysql database

Setup

1. Clone the repository

first, clone the repository:

git clone https://github.com/devsoli/docker-laravel.git
cd docker-laravel

2. Create the environment file

copy the .env.example file to .env:

cp .env.example .env

config database connection in .env file:

DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=password

3. Build app service

docker-compose build app

4. Run Docker Compose

to start the services, run:

docker-compose up -d

This command will run the Docker containers in the background.

5. Install dependencies

Enter the app container and install Composer dependencies:

docker-compose exec app composer install

6. Set the application key

Set the application key:

docker-compose exec app php artisan key:generate

7. Migrate the database

Migrate the database:

docker-compose exec app php artisan migrate

8. Access the application

After successfully running the above commands, your Laravel application should be accessible at http://localhost.

Useful commands

  • View logs:
docker-compose logs -f
  • Stop services:
docker-compose down
  • Access the container:
docker-compose exec app bash

Common issues

  • Ports are already in use: Make sure that ports 80 and 3306 are not being used by another service.
  • Permissions: If you encounter file permission issues, try the following commands:
sudo chown -R $USER:$USER .

If you encounter any issues or have any questions, please open a new issue in the Issues section.


I hope this guide helps you easily set up your Laravel projects with Docker.

docker-laravel's People

Contributors

devsoli avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.