version: '3'

volumes:
  postgres_data:
      driver: local

services:

  postgres:
      image: postgres
      volumes:
        - postgres_data:/var/lib/postgresql/data
      environment:
        POSTGRES_DB: keycloak
        POSTGRES_USER: keycloak
        POSTGRES_PASSWORD: P@ssw0rd1

  keycloak:
      image: quay.io/keycloak/keycloak:9.0.2
      environment:
        DB_VENDOR: POSTGRES
        DB_ADDR: postgres
        DB_DATABASE: keycloak
        DB_USER: keycloak
        DB_SCHEMA: public
        DB_PASSWORD: P@ssw0rd1
        KEYCLOAK_USER: admin
        KEYCLOAK_PASSWORD: Pa33w0rd
        # Uncomment the line below if you want to specify JDBC parameters. The parameter below is just an example, and it shouldn't be used in production without knowledge. It is highly recommended that you read the PostgreSQL JDBC driver documentation in order to use it.
        #JDBC_PARAMS: "ssl=true"
      ports:
        - 8081:8080
      depends_on:
        - postgres
