# Dockerfile
ARG PARENT_IMAGE=437795906767.dkr.ecr.us-east-1.amazonaws.com/docker-parent-images:python36
FROM $PARENT_IMAGE AS parent

WORKDIR    /var/app

# Update and install common packages
RUN        yum -y update
RUN        yum -y install curl tar zip wget

# Create and configure virtualenv
RUN        python3.6 -m venv /var/app

# Add application and install requirements
COPY       config.py main.py requirements.txt /var/app/
RUN        /var/app/bin/pip install -U pip
RUN        if [ -f /var/app/requirements.txt ]; then /var/app/bin/pip install -I -r /var/app/requirements.txt; fi
RUN        chown -R worker /var/app

# Set service user
USER       worker

ENTRYPOINT ["/var/app/bin/python", "main.py"]
