2022-01-30 23:24:00 +00:00
|
|
|
FROM python:3.10.2-bullseye as base
|
2021-12-22 23:21:23 +00:00
|
|
|
|
|
|
|
ENV PYTHONFAULTHANDLER=1 \
|
|
|
|
PYTHONHASHSEED=random \
|
|
|
|
PYTHONUNBUFFERED=1
|
|
|
|
|
|
|
|
WORKDIR /app
|
|
|
|
|
|
|
|
FROM base as builder
|
|
|
|
|
|
|
|
ENV PIP_DEFAULT_TIMEOUT=100 \
|
|
|
|
PIP_DISABLE_PIP_VERSION_CHECK=1 \
|
|
|
|
PIP_NO_CACHE_DIR=1 \
|
|
|
|
POETRY_VERSION=1.1.12
|
|
|
|
|
2022-12-24 20:13:53 +00:00
|
|
|
|
|
|
|
RUN apt update && apt install -y postgresql-client
|
|
|
|
|
2021-12-29 14:18:02 +00:00
|
|
|
# Create a /venv directory & environment.
|
|
|
|
# This directory will be copied into the final stage of docker build.
|
2021-12-22 23:21:23 +00:00
|
|
|
RUN python -m venv /venv
|
|
|
|
|
2021-12-29 14:18:02 +00:00
|
|
|
# Copy only the necessary files to build/install the python package
|
|
|
|
COPY pyproject.toml poetry.lock /app/
|
|
|
|
COPY mwmbl /app/mwmbl
|
2021-12-22 23:21:23 +00:00
|
|
|
|
2021-12-29 14:18:02 +00:00
|
|
|
# Working directory is /app
|
|
|
|
# Use pip to install the mwmbl python package
|
|
|
|
# PEP 518, PEP 517 and others have allowed for a standardized python packaging API, which allows
|
|
|
|
# pip to be able to install poetry packages.
|
|
|
|
RUN /venv/bin/pip install pip --upgrade && \
|
|
|
|
/venv/bin/pip install .
|
2021-12-22 23:21:23 +00:00
|
|
|
|
|
|
|
FROM base as final
|
|
|
|
|
2021-12-29 14:18:02 +00:00
|
|
|
# Copy only the required /venv directory from the builder image that contains mwmbl and its dependencies
|
2021-12-22 23:21:23 +00:00
|
|
|
COPY --from=builder /venv /venv
|
|
|
|
|
2022-06-19 10:16:03 +00:00
|
|
|
ADD nginx.conf.sigil /app
|
|
|
|
|
2022-06-17 22:12:22 +00:00
|
|
|
# Set up a volume where the data will live
|
|
|
|
VOLUME ["/data"]
|
2021-12-29 14:18:02 +00:00
|
|
|
|
2022-06-17 22:57:58 +00:00
|
|
|
EXPOSE 5000
|
|
|
|
|
2021-12-29 14:18:02 +00:00
|
|
|
# Using the mwmbl-tinysearchengine binary/entrypoint which comes packaged with mwmbl
|
2022-12-07 20:01:31 +00:00
|
|
|
CMD ["/venv/bin/mwmbl-tinysearchengine", "--num-pages", "10240000", "--background"]
|