36 lines
1.4 KiB
Docker
36 lines
1.4 KiB
Docker
FROM tiangolo/uvicorn-gunicorn-fastapi:python3.9-alpine3.14
|
|
|
|
ENV PYTHONPATH=/app
|
|
|
|
# Allow installing dev dependencies to run tests
|
|
ARG INSTALL_DEV=false
|
|
|
|
# For development, Jupyter remote kernel, Hydrogen
|
|
# Using inside the container:
|
|
# jupyter lab --ip=0.0.0.0 --allow-root --NotebookApp.custom_display_url=http://127.0.0.1:8888
|
|
ARG INSTALL_JUPYTER=false
|
|
|
|
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
|
|
|
|
|
|
COPY ./app /app
|