dockeropenshiftopenapiquarkusstylish

Quarkus Stylish not working in container images (Openshift / Docker)


We are updating our documentation and adding branding for the generated pages. We used the input described here (https://quarkus.io/blog/stylish-api/). However, for some reason, the styling works locally (when starting Quarkus in dev mode) but not running it in a container technology (we tried both OpenShift and Docker images. No css is applied, no logos are altered. Not for the landing page and not for generated swagger pages. Is there some setting / something we need to do additionally to get it working?

The following properties are set in the application.properties

quarkus.swagger-ui.title=Title
quarkus.swagger-ui.filter=true
quarkus.swagger-ui.enable=true
quarkus.swagger-ui.always-include=true

I suspect that none of the additional resources (in META-INF) are picked up by Quarkus when building a container image.

Structure:

\resources
  \META-INF
   application.properties
     beans.xml
     \branding
        logo.png
        style.css
     \resources
        favicon.ico
        index.html

We can see that the /swagger-ui/style.css is different. Running in dev the build process copies style.css from the branding dir to the /swagger-ui. This does (apparantly) not happen when building an image.

The /swagger-ui/ folder is placed under META_INF in the runner jar. It contains the wrong css (the original one). Running quarkus in dev mode apparantly does serve this folder from a different location (probably the branding location and replaces the original.

It's apparently somemthing in the maven build.


Solution

  • The quarkus-maven-plugin needs an additional goal (prepare) in order to include the css on the right location.

                <plugin>
                    <groupId>io.quarkus</groupId>
                    <artifactId>quarkus-maven-plugin</artifactId>
                    <version>${quarkus-plugin.version}</version>
                    <executions>
                        <execution>
                            <goals>
                                <goal>prepare</goal>
                                <goal>build</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
    

    After this the styling was applied.