FROM registry.uniworx.de/uniworx/containers/debian:12.5

RUN apt-get -y update

# Required packages
RUN apt-get -y install git git-restore-mtime exiftool g++ npm libsodium-dev haskell-stack zsh wget curl

# packages that we might require (copied from uni2work)
# TODO: review
RUN apt-get -y install --no-install-recommends locales-all ca-certificates

# frontend
RUN npm install -g n
RUN n 14.19.1

# backend
# RUN stack install happy # TODO: "Specified bucket does not exist" error on debian

# run git restore-mtime
# frontend-test
RUN apt-get -y install chromium

# frontend-test
ENV CHROME_BIN=chromium

# backend-dependencies
RUN apt-get -y install libghc-zlib-dev

# backend-dependencies
RUN apt-get -y install libpq-dev

# backend-dependencies
RUN apt-get -y install pkg-config

RUN apt-get -y install locales
RUN sed -i '/en_US.UTF-8/s/^# //g' /etc/locale.gen && \
    locale-gen
ENV LANG=en_US.UTF-8 LANGUAGE=en_US:en LC_ALL=en_US.UTF-8

RUN apt-get -y install llvm

RUN useradd -ms /bin/bash fradrive-env
# ADD --chown=fradrive-env:fradrive-env . /fradrive-src

USER fradrive-env

WORKDIR /fradrive-src

# pre-build frontend- and backend-dependencies
RUN pwd && ls -a . && make well-known
RUN make backend-dependencies