FROM python:3.7-alpine WORKDIR /app/ # Copy poetry.lock* in case it doesn't exist in the repo COPY ./app/pyproject.toml ./app/poetry.lock* /app/ RUN apk add --no-cache --virtual .build-deps curl g++ libffi-dev openssl-dev python3-dev libxslt-dev rust cargo && \ apk add --no-cache postgresql-dev && \ # Installing Poetry curl -sSL https://install.python-poetry.org | python3 - && \ ln -s /root/.local/bin/poetry && \ /root/.local/bin/poetry config virtualenvs.create false && \ # Installing python dependencies cd /app/ && \ sh -c "if [ $INSTALL_DEV == 'true' ] ; then /root/.local/bin/poetry install --no-root --no-interaction --no-ansi ; else /root/.local/bin/poetry install --no-root --no-interaction --no-ansi --only main ; fi" && \ # Installing jupyter notebooks sh -c "if [ $INSTALL_JUPYTER == 'true' ] ; then pip install jupyterlab ; fi" && \ # Cleanup # rm -r /root/.cargo && \ /root/.local/bin/poetry cache clear repository --all && \ apk --purge del .build-deps ENV C_FORCE_ROOT=1 COPY ./app /app WORKDIR /app ENV PYTHONPATH=/app COPY ./app/worker-start.sh /worker-start.sh RUN chmod +x /worker-start.sh CMD ["sh", "/worker-start.sh"]