FROM amazoncorretto:21-alpine-jdk

ARG FILENAME

COPY ${FILENAME} server.jar

# java.lang.UnsatisfiedLinkError: /usr/local/openjdk-21/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
# java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11FontManager
# JRRuntimeException: Error initializing graphic environment.
# https://stackoverflow.com/a/58765562/13017592
# https://github.com/docker-library/openjdk/pull/235#issuecomment-424466077
RUN apk add ttf-dejavu

WORKDIR /lsfusion

EXPOSE 7652

# Moved to enrypoint to be able to pass JAVA_OPTS, leaving exec-form
COPY entrypoint.sh /
RUN chmod +x /entrypoint.sh

ENTRYPOINT ["/entrypoint.sh"]