FROM 086679231553.dkr.ecr.us-east-1.amazonaws.com/docker-parent-images:python311
WORKDIR      /var/app

# Update and install common packages
USER        root
RUN         apt-get update \
              && apt-get -y upgrade \
              && apt-get -y clean \
              && rm -rf /var/lib/apt/lists/*

# Create and configure virtualenv and uwsgi
ENV         VIRTUAL_ENV /var/venv
RUN         python -m venv ${VIRTUAL_ENV}
ENV         PATH "$VIRTUAL_ENV/bin:$PATH"

RUN         pip install --upgrade pip setuptools

# Add application and install requirements
COPY        . /var/app
RUN         if [ -f /var/app/requirements-test.txt ]; then pip install -I -r /var/app/requirements-test.txt; fi

USER        worker

ENTRYPOINT [ "/var/app/lint-and-test.sh" ]
