Giter VIP home page Giter VIP logo

Comments (9)

floriankoch avatar floriankoch commented on May 23, 2024 1

@karianna for me, documentation is enough

from openjdk-docker.

floriankoch avatar floriankoch commented on May 23, 2024 1

Now all is working, thx for your help

from openjdk-docker.

karianna avatar karianna commented on May 23, 2024

@floriankoch The distroless images likely do not contain the font packages. Is there a particular font that your application is expecting to use?

from openjdk-docker.

floriankoch avatar floriankoch commented on May 23, 2024

@karianna SansSerif in our case

from openjdk-docker.

karianna avatar karianna commented on May 23, 2024

@brunoborges - I see three options here:

  • Ask distroless base image provider to provide a minimum set of fonts
  • Provide docs on how to add for end users
  • Bundle fonts with OpenJDK (which I think typically don't do as we prefer to allow the O/S to do so)

Thoughts?

from openjdk-docker.

floriankoch avatar floriankoch commented on May 23, 2024

@karianna any news here?

from openjdk-docker.

brunoborges avatar brunoborges commented on May 23, 2024

@floriankoch we are editing the documentation this week.

As for what we will be adding, you can see this example on how to add a package on a build-layer in a Dockerfile, and then copy installed packages to the final distroless image.

https://github.com/microsoft/openjdk-docker/blob/main/docker/distroless/Dockerfile.msopenjdk-17-jdk#L20-L27

from openjdk-docker.

brunoborges avatar brunoborges commented on May 23, 2024

@floriankoch can you please provide a sample Java code that tries to load the extra fonts? I'd like to test the instructions.

from openjdk-docker.

floriankoch avatar floriankoch commented on May 23, 2024

@brunoborges the error comes from a third party application (camunda) - i do not have the exact code

I added this to my multi stage dockerfile

RUN mkdir /dejavu \
    && tdnf install -y --releasever=2.0 --installroot /dejavu dejavu-sans-fonts
RUN mkdir /fontconfig \
    && tdnf install -y --releasever=2.0 --installroot /fontconfig fontconfig
RUN mkdir /freetype \
    && tdnf install -y --releasever=2.0 --installroot /freetype freetype

# Clean up
RUN rm -rf /dejavu/etc/dnf \
    && rm -rf /dejavu/run/* \
    && rm -rf /dejavu/var/cache/dnf

RUN rm -rf /fontconfig/etc/dnf \
    && rm -rf /fontconfig/run/* \
    && rm -rf /fontconfig/var/cache/dnf \
    && find /fontconfig/var/log -type f -size +0 -delete

RUN rm -rf /freetype/etc/dnf \
    && rm -rf /freetype/run/* \
    && rm -rf /freetype/var/cache/dnf \
    && find /freetype/var/log -type f -size +0 -delete
...

COPY --from=builder /dejavu /
COPY --from=builder /fontconfig /
COPY --from=builder /freetype /

and use this program to test if java find the fonts

import java.awt.*;


public class FontTest {

    public static void main(String[] args) {
        String[] names = GraphicsEnvironment.getLocalGraphicsEnvironment().getAvailableFontFamilyNames();

        System.out.println("Found " + names.length + " fonts:");

        for (String name : names) {
            System.out.println(name);
        }
    }
}

looks good so far ... now we test with the application

docker run -it -v $PWD:/tmp test:1 java -cp /tmp FontTest
Found 8 fonts:
DejaVu Sans
DejaVu Sans Condensed
DejaVu Sans Light
Dialog
DialogInput
Monospaced
SansSerif
Serif

from openjdk-docker.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.