How to load an init.sql into my postgres service image?

I have the following configuration:

stages:
  - build
  - test
  - deploy

services:
  - postgres:11

cache:
  paths:
    - .m2/

variables:
  MAVEN_OPTS: "-Dmaven.repo.local=.m2"
  POSTGRES_USER: "postgres"
  POSTGRES_PASSWORD: "--------------------"
  POSTGRES_DB: "-------------------"
  TAPPITZ_DATABASE_HOST: "pgsql"
  TAPPITZ_DATABASE_PORT: "5432"
  TAPPITZ_DATABASE_DATABASENAME: "---------"
  TAPPITZ_DATABASE_USERNAME: "postgres"
  TAPPITZ_DATABASE_PASSWORD: "---------------------"

test_backend_job:
  image: openjdk:8u212-jdk-stretch
  script:
    - mvn clean test

And I want to load a file that is in the repository being tested at tests/resources/init.sql into the postgres service database. In a docker-compose I would just mount the volume like this:

volumes:
      - ./tests/resources/init.sql:/docker-entrypoint-initdb.d/01_init_schema.sql:ro

But this cannot be done in a .gitlab-ci.yml file right? So how do we do it?

Hello have you found a solution to your problem?

Hello, i don’t use postgres service on GitLabCI but what do your sql file contain ?
If you want insert data for your tests, why don’t make this in your app ?