# Use an official Python runtime as a parent image
FROM python:3.8.2-alpine

# Copy pip configs for private repo
RUN mkdir -p /root/.config/pip/
COPY configs/pip.conf /root/.config/pip/
COPY configs/.pypirc /root/

# Set the working directory to /app
WORKDIR /app

# Install Python support for uWSGI
RUN apk update \
    && apk add musl-dev linux-headers gcc g++ libc-dev python3-dev icu-dev \
    && rm -rf /var/cache/apk/*

# Copy requirements
COPY ./requirements /app/requirements

# Install any needed packages specified in requirements.txt
RUN pip install --upgrade pip setuptools \
    && pip install --trusted-host pypi.python.org -r requirements/base.txt

# Copy the current directory contents into the container at /app
COPY . /app

# Make port 8000 available to the world outside this container
EXPOSE 8000

# Run application with uWSGI when the container launches
CMD ["ddtrace-run", "uwsgi", "--ini", "uwsgi.ini"]
