FROM python:3.7-alpine
ENV PYTHONUNBUFFERED 1
WORKDIR /app
COPY requirements.txt ./
COPY requirements.production.txt ./
COPY . ./

# uWSGI, gunicorn etc.
RUN apk add --no-cache python3-dev build-base linux-headers pcre-dev openssl bash \
  # PSQL
  && apk add --no-cache postgresql-dev \
  # Pillow
  && apk add --no-cache jpeg-dev zlib-dev \
  && pip install --upgrade pip \
  && pip install -r requirements.txt \
  && pip install -r requirements.production.txt

RUN python manage.py collectstatic --noinput

CMD ["sh", "-c", "./production_entrypoint.sh"]
