FROM        --platform=$TARGETOS/$TARGETARCH eclipse-temurin:21-jdk-noble

RUN         apt update -y \
            && apt install -y \
                curl \
                lsof \
                ca-certificates \
                openssl \
                git \
                tar \
                sqlite3 \
                fontconfig \
                tzdata \
                iproute2 \
                libfreetype6 \
                tini \
                zip \
                unzip \
                gnupg
                ##nodejs \
                ##npm

RUN curl -fsSL https://deb.nodesource.com/setup_23.x | bash - && \
    apt install -y nodejs

## Setup user and working directory
RUN         useradd -m -d /home/container -s /bin/bash container
USER        container
ENV         USER=container HOME=/home/container
WORKDIR     /home/container
##RUN git clone https://github.com/ThePansmith/Monifactory.git
##RUN cd ~/Monifactory/tools/build && npm install
##RUN node ~/Monifactory/tools/build build-server
##RUN cp ~/Monifactory/dist/server/* ~

STOPSIGNAL SIGINT

COPY        --chown=container:container ./entrypoint.sh /entrypoint.sh
RUN         chmod +x /entrypoint.sh
ENTRYPOINT    ["/usr/bin/tini", "-g", "--"]
CMD         ["/entrypoint.sh"]
