############################################################
# Dockerfile to run a Django-based web application
# Based on an Ubuntu Image
############################################################

# Set the base image to use to Ubuntu
FROM ubuntu:bionic

RUN apt-get update \
  && apt-get install -y python3-pip python3-dev \
  && cd /usr/local/bin \
  && ln -s /usr/bin/python3 python \
  && pip3 install --upgrade pip

# The environment variable ensures that the python output is set straight
# to the terminal without buffering it first
ENV PYTHONUNBUFFERED 1

# Set environment variable for current release
ENV CUR_RELEASE=release-1.11
# Create root directory for our project in the container
RUN mkdir /perf_dashboard

# Set the working directory to /perf_dashboard
WORKDIR /perf_dashboard

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

# Install any needed packages specified in requirements.txt
RUN pip3 install -r requirements.txt

# uWSGI will listen on this port
EXPOSE 8000

COPY ./docker-entrypoint.sh /

RUN chmod u+x docker-entrypoint.sh

ENTRYPOINT ["/docker-entrypoint.sh"]
