reypm / qrcodereader-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Logo

Development

The current project has package laravel/sail installed.

Steps to get a working development env:

  1. Copy the .env.example file and change the value of the environment variables as needed
$ cp .env.example .env
  1. Install required packages
# Using docker
$ docker run -it --rm -v $(pwd):/var/www/html -w /var/www/html/ composer install

# Or manually
$ composer install 
  1. Install zbar-tools package

Since we are using Sail, and we need to customize the Dockerfile to install the zbar-tools package then we need to run the following command:

sail artisan sail:publish

The above command will create a local copy of all Sail Dockerfiles under <path_to_your_project>/docker. The default PHP version used by Sail is currently PHP 8.2. Open the file <path_to_your_project>/docker/8.2/Dockerfile and add the package before install anything zbar-tools. You must end with something like the following:

RUN apt-get update \
    && apt-get install -y gnupg gosu curl ca-certificates zip unzip git supervisor sqlite3 libcap2-bin libpng-dev python2 dnsutils \
    && curl -sS 'https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x14aa40ec0831756756d7f66c4f4ea0aae5267a6c' | gpg --dearmor | tee /etc/apt/keyrings/ppa_ondrej_php.gpg > /dev/null \
    && echo "deb [signed-by=/etc/apt/keyrings/ppa_ondrej_php.gpg] https://ppa.launchpadcontent.net/ondrej/php/ubuntu jammy main" > /etc/apt/sources.list.d/ppa_ondrej_php.list \
    && apt-get update \
    && apt-get install -y zbar-tools php8.2-cli php8.2-dev \ 
    ...
  1. Build the required containers used by the app

Now that you should have a custom copy of the Dockerfile shipped with Laravel Sail is time to build the new image containing the zbar-tools package. Open your <<path_to_your_project>/docker-compose.yml and change the image name that gets build.

    laravel.test:
        build:
            context: ./docker/8.2
            dockerfile: Dockerfile
            args:
                WWWGROUP: '${WWWGROUP}'
        image: sail-8.2/app-custom
        ...

Then run the following command:

$ ./vendor/bin/sail build --no-cache
  1. Start up the containers
$ ./vendor/bin/sail up -d

Check the sail doc for more commands to run.

  1. Generate the APP_KEY variable value
$ ./vendor/bin/sail artisan key:generate
  1. Run the migrations
$ ./vendor/bin/sail artisan migrate

At this point you should be able to access the application at http://localhost

References

License

The Laravel framework is open-sourced software licensed under the MIT license.

About


Languages

Language:PHP 61.2%Language:Blade 31.9%Language:Dockerfile 5.7%Language:Shell 0.6%Language:JavaScript 0.6%Language:CSS 0.0%