mwmbl/Dockerfile

61 lines
1.6 KiB
Text
Raw Permalink Normal View History

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
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
# Create a /venv directory & environment.
# This directory will be copied into the final stage of docker build.
RUN python -m venv /venv
# Copy only the necessary files to build/install the python package
COPY pyproject.toml poetry.lock /app/
COPY mwmbl /app/mwmbl
# 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.
# 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
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
# Copy only the required /venv directory from the builder image that contains mwmbl and its dependencies
COPY --from=builder /venv /venv
2023-10-12 19:52:51 +00:00
# Copy the front end build
COPY --from=front-end /front-end/dist /front-end-build
2023-10-12 19:52:51 +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"]
2022-06-17 22:57:58 +00:00
EXPOSE 5000
2023-10-10 12:51:06 +00:00
CMD ["/venv/bin/mwmbl-tinysearchengine"]