FROM debian:buster-slim

## install dependencies
RUN apt-get update && \
    apt-get upgrade -y && \
    apt-get install -y sudo vim nano locales unzip && \
    localedef -i fr_FR -c -f UTF-8 -A /usr/share/locale/locale.alias fr_FR.UTF-8 && \
    apt-get clean

## set envs
ENV LANG fr_FR.utf8
ENV TERM xterm

RUN adduser --uid 1000 --gecos ""  --disabled-password appuser
RUN usermod -aG sudo appuser
RUN echo "appuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers

#COPY . /home/appuser/citizen
COPY vendor/GeoNature-citizen /home/appuser/citizen
COPY patches/settings.ini /home/appuser/citizen/config/
COPY patches/start.sh /home/appuser/
COPY patches/install_app.sh /home/appuser/citizen/install

RUN chown -R appuser:appuser /home/appuser
USER appuser
WORKDIR /home/appuser/citizen
#RUN install/install_app.sh

VOLUME /var/lib/postgresql
VOLUME /etc/postgresql
VOLUME /etc/apache2
VOLUME /etc/supervisor

EXPOSE 80
EXPOSE 5432

#CMD ["/home/appuser/start.sh"; ";", "/bin/bash"]
CMD ["/bin/bash"]
