#FROM python:3.7-alpine
FROM python:3.7-slim
LABEL maintainer="drew@androiddrew.comw"

# Set environmental variables
ENV PYTHONUNBUFFERED 1
ENV PYTHONDONTWRITEBYTECODE 1

# Set Working Directory
WORKDIR /code

# install psycopg2
#RUN apk update \
#    && apk add --virtual build-deps gcc python3-dev musl-dev \
#    && apk add postgresql-dev \
#    && pip install psycopg2 \
#    && apk del build-deps

# Install dependencies
RUN pip install --upgrade pip
COPY ./requirements.txt /code/requirements.txt
RUN pip install -r /code/requirements.txt

# Copy entrypoint.sh
COPY ./entrypoint.sh /code/entrypoint.sh

# Copy code to image
COPY . /code/

RUN useradd wagtail && chown -R wagtail /code

RUN apt update && apt -y install netcat

USER wagtail

# run entrypoint.sh
ENTRYPOINT ["/code/entrypoint.sh"]

