Before you get to deploying this application on Google Cloud, you can test the application locally with Docker and Docker Compose.
In this section, we'll build the application on our local machine, and using the provided configuration file, we'll deploy the app locally.
You will need to install:
- Docker Desktop
- Docker Compose
This local deployment will use the same image as our production deployment will, but will make use of the included docker-compose.yml
to connect together the components.
If you are familiar with git
:
git clone [email protected]:villers/laravel-cloud-run-sql.git
cd laravel-cloud-run-sql
Before we can use our image, we have to build it. The database image will be pulled down later, so we just need to manually build our web image:
docker-compose build
Now we have a database, and a build web image, we can start them:
docker-compose up
- Be sure the composer and php is installed in your system. (not in the docker)
At the moment the database is empty. We can use standard django commands to run our database migrations, and add some default data; these instructions need to be run the context of our web image:
docker-compose run --rm app php artisan migrate --seed
You can now see app running in your browser at http://localhost:8080/
Next step: Setup Google Cloud Platform environment