How to do it in the right way?

Hi all

I am trying to write my first DroneCI pipeline and struggle with the question, how to do it in the right way.
I have a project based on maven, that first has to be to compile, to get the JAR file. After that, it should run docker-compose to deploy containers on the same host as the pipeline was triggered, for that, I use drone exec runner.

The docker-compose file:

version: '3.7'
services:

  postgres:
    image: postgres:12.2
    container_name: postgres
    environment:
      POSTGRES_DB: ${KC-DB}
      POSTGRES_USER: ${KC-DB-USER}
      POSTGRES_PASSWORD: ${KC-DB-PW}

  keycloak:
    image: jboss/keycloak:9.0.2
    container_name: keycloak
    environment:
      DB_VENDOR: POSTGRES
      DB_ADDR: postgres
      DB_DATABASE: ${KC-DB}
      DB_USER: ${KC-DB-USER}
      DB_PASSWORD: ${KC-DB-PW}
      KEYCLOAK_USER: ${KC-USER}
      KEYCLOAK_PASSWORD: ${KC-PW}
      PROXY_ADDRESS_FORWARDING: "true"
      TZ: UTC
      #KEYCLOAK_DEFAULT_THEME: theme-minimal
      #KEYCLOAK_LOGLEVEL: DEBUG
    command:
      - "-Dkeycloak.migration.action=import -Dkeycloak.migration.provider=dir -Dkeycloak.profile.feature.upload_scripts=enabled -Dkeycloak.migration.dir=/opt/jboss/keycloak/import-dir -Dkeycloak.migration.strategy=OVERWRITE_EXISTING"
    volumes:
      - ./config/standalone-ha.xml:/opt/jboss/keycloak/standalone/configuration/standalone-ha.xml
      - ./config/import-dir:/opt/jboss/keycloak/import-dir
      - ./theme/target/theme-${KC-THEME-VERSION}.jar:/opt/jboss/keycloak/standalone/deployments/dataxu-theme-${KC-THEME-VERSION}.jar
      - ./spi-registration-profile/target/spi-registration-profile-${KC-REGISTRATION-VERSION}.jar:/opt/jboss/keycloak/standalone/deployments/spi-registration-profile-${KC-REGISTRATION-VERSION}.jar
    external_links:
      - traefik
    depends_on:
      - postgres
      - mailhog

  mailhog:
    image: mailhog/mailhog:latest
    container_name: mailhog
    ports:
      - "8025:8025"  

The question is, how to do it in the right way?

Thanks