FROM nikolaik/python-nodejs:python3.12-nodejs18

RUN apt-get update && apt-get install -y libpq-dev curl jq

RUN curl -s -L $(curl https://api.github.com/repos/tus/tusd/releases/latest -s | jq '.assets[] | select(.name=="tusd_linux_amd64.tar.gz") | .browser_download_url' -r) | tar -xzvf - -C /usr/local/bin/ --strip-components=1 tusd_linux_amd64/tusd && chmod +x /usr/local/bin/tusd

WORKDIR /app

COPY requirements.txt requirements.txt
RUN pip3 install -r requirements.txt

RUN npm install -g npm

RUN mkdir client
COPY ./client /app/client

RUN cd client && npm ci --also=dev && cd ..

COPY . /app

ENV LANG=C.UTF-8
ARG GIT_COMMIT_HASH
ENV GIT_COMMIT_HASH=${GIT_COMMIT_HASH:-undefined}

CMD python -m src daemon
