FROM python:3.8-slim
LABEL name=laser-app version=0.1

WORKDIR /opt
RUN apt update
RUN apt install -y --no-install-recommends build-essential\
 gcc\
 libagg2-dev\
 libpotrace-dev\
 nginx-light\
 pkg-config\
 python-dev\
 redis-server
RUN rm -f /etc/nginx/sites-enabled/*
RUN pip3 install flask numpy pillow redis
RUN pip3 install pypotrace

COPY ./server/files/nginx/sites-enabled/site.conf /etc/nginx/sites-enabled
COPY . .

COPY ./server/entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh

EXPOSE 80
EXPOSE 5000
EXPOSE 9001

# Start the main process.
CMD ["python", "./server.py", "-i", "db"]
