2023-11-09 13:44:43 +00:00
|
|
|
FROM node:hydrogen-bullseye as front-end
|
2023-10-12 19:52:51 +00:00
|
|
|
|
|
|
|
COPY front-end /front-end
|
|
|
|
WORKDIR /front-end
|
|
|
|
RUN npm install && npm run build
|
|
|
|
|
|
|
|
|
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
|
|
|
|
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.
|
2022-12-27 02:30:35 +00:00
|
|
|
# en-core-web-sm requires a compatible version of spacy
|
|
|
|
RUN /venv/bin/pip install pip wheel --upgrade && \
|
|
|
|
/venv/bin/pip install . && \
|
|
|
|
/venv/bin/python -m spacy download en_core_web_sm-3.2.0 --direct && \
|
|
|
|
/venv/bin/python -m spacy validate
|
2021-12-22 23:21:23 +00:00
|
|
|
|
|
|
|
FROM base as final
|
|
|
|
|
2023-01-02 12:19:10 +00:00
|
|
|
RUN apt-get update && apt-get install -y postgresql-client
|
2023-01-02 12:18:03 +00:00
|
|
|
|
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
|
|
|
|
|
2023-10-12 19:52:51 +00:00
|
|
|
# Copy the front end build
|
2023-10-12 20:21:30 +00:00
|
|
|
COPY --from=front-end /front-end/dist /front-end-build
|
2023-10-12 19:52:51 +00:00
|
|
|
|
2023-10-27 05:44:04 +00:00
|
|
|
ADD nginx.conf.sigil /app
|
2023-10-28 15:38:56 +00:00
|
|
|
# ADD app.json /app
|
2022-06-19 10:16:03 +00:00
|
|
|
|
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
|
|
|
|
|
2023-10-10 12:51:06 +00:00
|
|
|
CMD ["/venv/bin/mwmbl-tinysearchengine"]
|