PostGIS initialization in existed database question

I have an existing project with existing database, that using postgres:15 image.

Now in the database I was needed to add PostGIS extension. I followed official examples for Dockerfile from this PostGIS image: https://hub.docker.com/r/postgis/postgis

And I ended up adding this 3 files:

https://github.com/postgis/docker-postgis/blob/master/15-3.4/update-postgis.sh (can’t add more than 2 links in a post)

My part in docker-compose.yml related to DB now look like this:

version: "3.7"
services:
  db:
    container_name: project-db
    # image: postgres:15
    build:
      context: .
      dockerfile: db.Dockerfile
    ports:
      - "${DB_PORT:-5432}:5432"
    volumes:
      - project-db-data:/var/lib/postgresql/data/pgdata
    env_file:
      - .env
    environment:
      POSTGRES_DB: ${DB_NAME}
      POSTGRES_USER: ${DB_USER}
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      PGDATA: /var/lib/postgresql/data/pgdata
    healthcheck:
      test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
      interval: 5s
      timeout: 5s
      retries: 5
...

Changed part was that image replaced by db.Dockerfile from link above.

Now, when I run my project, it started, but PostGIS was not initialized. When it properly initialized it add table spartial_ref_sys, but it was not happened, not that any new functions or column types (geometry) were added. I tested that on static (non-docker) DB before starting tests in docker. I was successfully added extension there, but it was not added in docker.

I read a couple of similar questions here and on stack overflow, but it seems like that initdb shell script run only on newly created volume. But in my case it an addition to existed project. I tried various ways, but couldn’t manage to make proper PostGIS initialization.

Does anyone have suggestions?