Giter Site home page Giter Site logo

laravel's Introduction

Laravel Docker ๐Ÿณ

A generic docker environment for Laravel with mySql and Nginx

Insstallation

  1. Click Use this template
  2. Clone the repository containing the docker-compose.yml file.
  3. Run the following command to build the Docker image:
$ docker compose build

This command will download all the necessary dependencies and build the Docker image according to the specifications in the Dockerfile.

  1. Once the build is complete, run the following command to start the Docker container:
$ docker-compose up -d
  1. Run the following command to create a new Laravel project inside a src directory:
$ sudo chmod 777 src/
$ docker compose exec php composer create-project --prefer-dist laravel/laravel .

This command will install all the necessary dependencies and create a new Laravel project inside the src directory.

  1. Run other esential commands -
$ docker compose exec php php artisan storage:link
$ docker compose exec php chmod -R 777 storage bootstrap/cache
  1. Run the following command to migrate database docker compose exec php php artisan migrate:refresh. Before migration please update environment variable for database.
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=laravel
DB_USERNAME=root
DB_PASSWORD=1234

Acces Webpage

To access the web page for your Laravel project, please follow these steps:

Ensure that the Docker container is running by running the command docker ps in your terminal or command prompt. This command will display a list of all the running Docker containers on your system.

Open a web browser and navigate to the following URL: http://localhost:8999. This URL corresponds to the port that has been exposed in the docker-compose.yml file for the Nginx service.

How to setup different PHP version?

To update the PHP version for your Docker container, please follow these steps:

Open the Dockerfile for your PHP image, which is located in the docker/php/ directory.

Update the FROM statement to use the base image for the PHP version you want to use. For example, to use PHP version 7.4, you can change the FROM statement to the following:

FROM php:7.4-fpm

Save the Dockerfile and build the Docker image again using the docker-compose build command.

Once the build is complete, start the Docker container using the docker-compose up command.

laravel's People

Contributors

senthilpsg 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.