FROM python:3.9-slim


# STEP 1) Setting up environment
# apt packages
RUN apt-get update && \
    apt-get --yes upgrade && \
    apt-get install --yes libgomp1 && \
    apt-get install --yes postgresql-client && \
    apt-get install --yes --reinstall build-essential && \
    apt-get -y install curl vim less nano git && \
    apt-get -y install zip unzip && \
    apt-get clean

WORKDIR /usr/src/etl
RUN python -m pip install --upgrade pip
COPY etl/requirements.txt .
RUN pip install -r requirements.txt

RUN mkdir /sak_user
# RUN /usr/sbin/usermod -d /sak_user root
RUN HOME=/sak_user
COPY documentation/radmc3d_install.sh .
RUN chmod 755 radmc3d_install.sh
RUN HOME=/sak_user;./radmc3d_install.sh
ENV PATH="/sak_user/bin:${PATH}"
ENV PYTHONPATH="/sak_user/bin/python:${PYTHONPATH}"
RUN chmod 755 /sak_user/bin/radmc3d

# STEP 2) Bundling app
COPY etl .

CMD python main.py