# Dockerfile

ARG  AWS_ACCOUNT=086679231553

FROM ${AWS_ACCOUNT}.dkr.ecr.us-east-1.amazonaws.com/docker-parent-images:python313 AS base


USER root
# Update and install common packages
RUN  apt-get update && apt-get -y upgrade
RUN  apt-get -y install git tar 

WORKDIR /var/app

# Add worker user
RUN  useradd executor -s /bin/false

# Add application, create env and install requirements
COPY  . /var/app

RUN chown -R worker:worker /var/app

# Upgrade system pip and setuptools as they will not be upgraded below and cause security issues.
RUN pip install --upgrade pip setuptools

RUN  python -m venv --clear /var/app/env
RUN  /var/app/env/bin/pip install --upgrade pip
RUN  if [ -f /var/app/requirements.txt ]; then /var/app/env/bin/pip install -I -r /var/app/requirements.txt; fi

USER  worker

ENTRYPOINT ["/var/app/env/bin/ddtrace-run", "/var/app/env/bin/python3", "/var/app/main.py"]

EXPOSE  8080
