private static String buildDockerComposeConfig(
            boolean setupElasticsearch,
            boolean setupMinio,
            boolean setupMongo,
            boolean setupRedis,
            boolean setupTurmsAdmin,
            boolean setupTurmsGateway,
            List<String> turmsGatewayJvmOptions,
            boolean setupTurmsService,
            List<String> turmsServiceJvmOptions) {
        InputStream resource = TestEnvironmentContainer.class.getClassLoader()
                .getResourceAsStream(DOCKER_COMPOSE_TEST_FILE);
        if (resource == null) {
            throw new RuntimeException(
                    "Could not find the resource: "
                            + DOCKER_COMPOSE_TEST_FILE);
        }
        YAMLMapper yamlMapper = YAMLMapper.builder()
                .enable(YAMLGenerator.Feature.LITERAL_BLOCK_STYLE)
                .build();
        Map<String, Object> config;
        try {
            config = yamlMapper.readValue(resource, Map.class);
        } catch (Exception e) {
            throw new RuntimeException("Failed to parse the docker compose config", e);
        }
        Map<String, Object> services = (Map<String, Object>) config.get("services");
        if (!setupElasticsearch) {
            removeService(services, ELASTICSEARCH);
        }
        if (!setupMinio) {
            removeService(services, MINIO);
        }
        if (!setupMongo) {
            removeService(services, MONGO);
            removeService(services, MONGO_SHARD);
            removeService(services, MONGO_CONFIG);
        }
        if (!setupRedis) {
            removeService(services, REDIS);
        }
        if (!setupTurmsAdmin) {
            removeService(services, TURMS_ADMIN);
        }
        if (setupTurmsGateway) {
            appendCustomJvmOptions(turmsGatewayJvmOptions,
                    services,
                    TURMS_GATEWAY,
                    TURMS_GATEWAY_JVM_OPTION_NAME);
        } else {
            removeService(services, TURMS_GATEWAY);
        }
        if (setupTurmsService) {
            appendCustomJvmOptions(turmsServiceJvmOptions,
                    services,
                    TURMS_SERVICE,
                    TURMS_SERVICE_JVM_OPTION_NAME);
        } else {
            removeService(services, TURMS_SERVICE);
        }
        try {
            return yamlMapper.writeValueAsString(config);
        } catch (Exception e) {
            throw new RuntimeException("Failed to serialize the docker compose config", e);
        }
    }
@param dockerCompose TODO: Use InputStream instead of File once DockerComposeContainer
                     supports
                     (https://github.com/testcontainers/testcontainers-java/issues/3431)
turms-server-test-common/src/main/java/im/turms/server/common/testing/environment/TestEnvironmentContainer.java