FROM python:3.7-alpine

RUN apk add --update --no-cache alpine-sdk g++ gcc linux-headers libxslt-dev python3-dev build-base openssl-dev libffi-dev git bash && \
    pip install --no-cache --upgrade pip setuptools pipenv requirements-builder

RUN apk add --no-cache --allow-untrusted \
    --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/community \
    --repository http://dl-cdn.alpinelinux.org/alpine/latest-stable/main \
    --repository http://nl.alpinelinux.org/alpine/edge/community \
    git-lfs && \
    git lfs install

COPY setup.py README.rst CHANGES.rst /code/renku/
WORKDIR /code/renku
RUN requirements-builder -e all --level=pypi setup.py > requirements.txt && \
    pip install -r requirements.txt && pip install gunicorn

COPY . /code/renku
RUN pip install -e .

ENTRYPOINT ["gunicorn", \
            "renku.service.entrypoint:app", \
            "-b", "0.0.0.0:8080", \
            "--timeout", "600", \
            "--workers", "4", \
            "--worker-class", "gthread", \
            "--threads", "8"\
]
