FROM python:3

LABEL Name=url_shorter
EXPOSE 5000

#Copy files to work directory
WORKDIR /app
ADD ./static /app/static
ADD ./templates /app/templates
COPY *.py /app/
COPY export.sh /app/
COPY import.sh /app/
COPY VERSION /app/VERSION
COPY requirements.txt /app/requirements.txt

#Make a complete system update. apt-utils is needed for configuring packages, so we need to install it
RUN apt update
RUN apt install apt-utils sqlite3 -y
RUN apt upgrade -y
RUN apt clean

#Install libraries
RUN python3 -m pip install -r requirements.txt

#Make import and export scripts executable
RUN chmod +x /app/import.sh
RUN chmod +x /app/export.sh

#Make a builddate file, used if you want to see the builddate in the webui
RUN date > builddate.txt

#everytime the container starts run main.py
ENTRYPOINT python3 main.py