# Python Eve DigiLocker Accounts Services
# Build by; Saurabh Kumar Pandey@14122020

FROM python:3.8.6-slim
MAINTAINER DigiLocker Accounts Services
LABEL version="1.0"
ENV TZ="Asia/Kolkata"

#ENV http_proxy http://10.247.0.4:3128
#ENV https_proxy http://10.247.0.4:3128

RUN apt update
RUN apt install -y supervisor
RUN apt install debian-keyring debian-archive-keyring apt-transport-https curl lsb-release -y
RUN curl -sL 'https://deb.dl.getenvoy.io/public/gpg.8115BA8E629CC074.key' |  gpg --dearmor -o /usr/share/keyrings/getenvoy-keyring.gpg
RUN echo a077cb587a1b622e03aa4bf2f3689de14658a9497a9af2c427bba5f4cc3c4723 /usr/share/keyrings/getenvoy-keyring.gpg | sha256sum --check
RUN echo "deb [arch=amd64 signed-by=/usr/share/keyrings/getenvoy-keyring.gpg] https://deb.dl.getenvoy.io/public/deb/debian $(lsb_release -cs) main" | tee /etc/apt/sources.list.d/getenvoy.list
RUN apt-get update 
RUN apt-get install -y vim
RUN apt-get install -y getenvoy-envoy 
RUN apt-get install -y gcc

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

RUN mkdir -p /etc/envoy

ADD config-local/dockerconfig/envoy-eve-local.yaml /etc/envoy/envoy-eve-local.yaml

#RUN unset http_proxy https_proxy
RUN mkdir -p /etc/supervisord.d
COPY config-local/dockerconfig/supervisord.conf /etc/supervisord.conf
COPY config-local/dockerconfig/services.conf /etc/supervisord.d/services.conf

WORKDIR /opt/accounts_services
COPY src_code /opt

EXPOSE 80

CMD ["/usr/bin/supervisord", "-n"]