2.0 Configuration - germanngc/invoiceSender GitHub Wiki

We are assuming in this page that you will clone/fork and continue working with this project.

Remember, you can configure below files in order to match your own requirements.

  • Dockerfile
  • docker-compose.yml
  • .env

2.1 Clone the repo

git clone https://github.com/germanngc/invoiceSender.git

2.2 Update composer packages

cd invoiceSender
composer update

2.3 Configure Laravel

2.3.1 Environment File

Get a copy of the env file of Laravel

cp .env.example .env

Add basic configuration to your Laravel environment file, modify at least below variables.

APP_NAME=invoiceSender
APP_URL=http://localhost:8081
DB_CONNECTION=mysql
DB_HOST=db
DB_PORT=3306
DB_DATABASE=invSend
DB_USERNAME=invSend
DB_PASSWORD=invSend123456

2.3.2 Generate the APP Key

php artisan key:generate

2.4 Docker

2.4.1 Install if not already

2.4.2 Build Images

docker-compose build

Validate image was built

$ docker images | grep invoicesender
invoicesender             latest          2216494c8a1e   1 minutes ago   636MB
$

2.4.3 Run containers

docker-compose up -d

Validate the containers are running.

docker ps
CONTAINER ID   IMAGE               COMMAND                  CREATED          STATUS         PORTS                                                  NAMES
605f904b7e04   mysql:8             "docker-entrypoint.s…"   13 seconds ago   Up 5 seconds   33060/tcp, 0.0.0.0:3308->3306/tcp, :::3308->3306/tcp   invoicesender-db
4be5e578e87d   nginx:1.21-alpine   "/docker-entrypoint.…"   13 seconds ago   Up 6 seconds   0.0.0.0:8081->80/tcp, :::8081->80/tcp                  invoicesender-nginx
f83f7c7594b1   invoicesender       "docker-php-entrypoi…"   13 seconds ago   Up 9 seconds   9000/tcp                                               invoicesender-app

2.5 Running Database Migrations

As the application is running on a docker container, we must run particular docker command in order to connect to all the services, like the database from the App.

docker exec invoicesender-app php artisan migrate

2.6 Accessing the Web App

Go to http://localhost:8081

If everything got configured correctly, you will see the Laravel Wellcome Page