How to add postgis for postgres in CI


I’m trying to get Phoenix, Elixir CI working with PostGIS. This is my .gitlab-ci.yml file.

image: elixir:1.4

  - postgres:9.6
  - mdillon/postgis

  MIX_ENV: "test"

  # Setup phoenix dependencies
  - apt-get update
  - apt-get install -y postgresql-client
  - mix local.hex --force
  - mix local.rebar --force
  - mix deps.get --only test
  - mix ecto.reset

- mix test

I thought that PostGIS is installed using mdillon/postgis. But when the CI runs, it gives me.

Generated smish_scaphold_model app
The database for SmishScapholdModel.Repo has already been dropped
The database for SmishScapholdModel.Repo has been created
** (Postgrex.Error) ERROR 58P01 (undefined_file): could not open extension control file "/usr/share/postgresql/9.6/extension/postgis.control": No such file or directory
    (ecto) lib/ecto/adapters/sql.ex:195: Ecto.Adapters.SQL.query!/5
    (ecto) lib/ecto/adapters/postgres.ex:86: anonymous fn/4 in Ecto.Adapters.Postgres.execute_ddl/3
    (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/adapters/postgres.ex:86: Ecto.Adapters.Postgres.execute_ddl/3
    (ecto) lib/ecto/migration/runner.ex:98: anonymous fn/2 in Ecto.Migration.Runner.flush/0
    (elixir) lib/enum.ex:1755: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ecto) lib/ecto/migration/runner.ex:96: Ecto.Migration.Runner.flush/0
    (stdlib) timer.erl:181:

Try to reproduce the situation outside of the CI, see if you have the same issues.