Add Liquibase with docker-compose

So I got a way to handle the liquibase update command. Here’s what I used as my Liquibase service, if it helps anyone:

Liquibase:
    # Image to be pulled from Docker Hub
    image: liquibase/liquibase:4.9.1
    # Name of the container
    container_name: Liquibase_container
    # Setting depends_on to PostgreSQL container to wait till the service is ready to accept connections
    depends_on:
      PostgreSQL:
        condition: service_healthy
    # Volume to add the liquibase collection of scripts
    volumes:
      - ./database/sql/liquibase/changeLog/:/liquibase/changelog/
    # Command to run the liquibase update service
    command: --defaults-file=/liquibase/changelog/liquibase.properties update

I moved my changeLog files to a volume inside the container named liquibase/changelog and then used the command to run update.

1 Like