FROM python:3.10.10-buster AS builder

RUN rm /bin/sh && ln -s /bin/bash /bin/sh
RUN echo 'debconf debconf/frontend select Noninteractive' | debconf-set-selections

RUN apt-get update
RUN yes | apt install postgresql gcc musl-dev
RUN pip install --upgrade pip
RUN apt install bash gettext
RUN pip install uvicorn gunicorn Celery gevent

COPY requirements.txt /requirements/requirements.txt
RUN pip install -r /requirements/requirements.txt --no-cache-dir

# NodeJS
RUN apt-get update && apt-get install -y -q --no-install-recommends \
        apt-transport-https \
        build-essential \
        ca-certificates \
        curl \
        git \
        libssl-dev \
        wget \
    && apt install -y xdg-utils --fix-missing \
    && rm -rf /var/lib/apt/lists/*
ENV NVM_DIR /usr/local
# RUN mkdir NVM_DIR
ENV NODE_VERSION 18.18.0
RUN curl https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash \
    && . $NVM_DIR/nvm.sh \
    && nvm install $NODE_VERSION \
    && nvm alias default $NODE_VERSION \
    && nvm use default
ENV NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
ENV PATH      $NVM_DIR/v$NODE_VERSION/bin:$PATH
