FROM node:18.20.4-slim

# Cache apt-get update and package installs
RUN --mount=target=/var/lib/apt/lists,type=cache,sharing=locked \
    --mount=target=/var/cache/apt,type=cache,sharing=locked \
    rm -f /etc/apt/apt.conf.d/docker-clean \
    && apt-get update \
    && apt-get -y --no-install-recommends install \
    wget libzmq3-dev libzmq5 libmariadb-dev libcurl4

# SSL 1.1 setup
# download install package
RUN wget http://ftp.us.debian.org/debian/pool/main/o/openssl/libssl1.1_1.1.1w-0+deb11u1_amd64.deb && dpkg -i libssl1.1_1.1.1w-0+deb11u1_amd64.deb

RUN npm i -g pm2

RUN adduser --disabled-password --home /home/container container

USER container

COPY dockerstart.sh /

WORKDIR /home/container

ENV HOME=/home/container

# Set entrypoint
CMD ["bash", "/dockerstart.sh"]
