How to preconfigure elasticsearch’s ingest pipelines using Docker compose?

I have an elasticsearch dependency for my app and I’m using the following configuration in the docker-compose.yml file:

elasticsearch:
    image: docker.elastic.co/elasticsearch/elasticsearch:6.6.0 
    ports:
      - "9200:9200"
    volumes:
      - esdata:/usr/share/elasticsearch/data

This builds the image correctly and installs the ingest-geoip and ingest-useragent plugin correctly:

[2020-04-17T12:52:21,839][INFO ][o.e.p.PluginsService ] [dStP6fF] loaded plugin [ingest-geoip]
[2020-04-17T12:52:21,839][INFO ][o.e.p.PluginsService ] [dStP6fF] loaded plugin [ingest-user-agent]

I, however, need to create two different pipelines for these plugins using a PUT request. Ideally, as part of the image building, the pipelines should only be created once.

This is the body of the PUT request:

{
    "parse_ip_ua": {
        "description": "Parse IP Address and User Agent information",
        "processors": [
            {
                "user_agent": {
                    "field": "user_agent",
                    "target_field": "useragent",
                    "ignore_missing": true
                }
            },
            {
                "geoip": {
                    "field": "ip_address",
                    "ignore_missing": true
                }
            }
        ]
    }
}

Any idea on how to achieve this? Thanks in advance.

Source: StackOverflow