Installing postgis on Laravel Sail

Simple solution:

In your dockerfile … swap out

    postgres: 
        image: 'postgres:17'

for

    postgres: 
        image: 'postgis/postgis:17-3.5-alpine'

https://hub.docker.com/r/postgis/postgis

Then put this in one of your migrations

    public function up(): void
    {
        DB::statement('CREATE EXTENSION IF NOT EXISTS postgis');

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *