Skip to content

[Enhancement]: Add OpenFGAContainer #8367

@rwinch

Description

@rwinch

Module

Core

Proposal

Spring Security is currently working on adding support for OpenFGA and I think that adding official Testcontainers support for OpenFga's Existing Docker Image . I'm able to do this with a GenericContainer, but it is a little bit of work to get working because the default checks do not work due to the image being hardened (e.g. /bin/sh is not available).

For the record this is what I'm currently doing (it could certainly use polish as well):

@Bean
GenericContainer<?> openFgaContainer(DynamicPropertyRegistry registry) {
var result = new GenericContainer<>("openfga/openfga:latest")
		.withCommand("run")
		.waitingFor(Wait.forHttp("/playground").forPort(3000).withStartupTimeout(Duration.ofMinutes(2)))
		.withEnv("OPENFGA_HTTP_ADDR","0.0.0.0:4000")
		.withExposedPorts(4000, 8081, 3000);
registry.add("openfga.fgaApiUrl", () -> {
	Integer httpPort = result.getMappedPort(4000);
	return "http://localhost:"+httpPort;
});
return result;
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions