# The image tagged with the 'full' suffix ARG IMAGE_BASE_NAME ARG BASE_IMAGE_HASH ARG BASE_MITIE_IMAGE_HASH ARG BASE_BUILDER_IMAGE_HASH FROM ${IMAGE_BASE_NAME}:base-mitie-${BASE_MITIE_IMAGE_HASH} as mitie FROM ${IMAGE_BASE_NAME}:base-builder-${BASE_BUILDER_IMAGE_HASH} as builder COPY --from=mitie /build/data /build/data # copy files COPY . /build/ COPY docker/configs/config_pretrained_embeddings_spacy_en_duckling.yml /build/config.yml # change working directory WORKDIR /build # install dependencies RUN python -m venv /opt/venv && \ . /opt/venv/bin/activate && \ pip install --no-cache-dir -U "pip==22.*" -U "wheel>0.38.0" RUN . /opt/venv/bin/activate && poetry install --extras full --no-dev --no-root --no-interaction RUN . /opt/venv/bin/activate && make install-mitie && \ poetry build -f wheel -n && \ pip install --no-deps dist/*.whl && \ rm -rf dist *.egg-info # make sure we use the virtualenv ENV PATH="/opt/venv/bin:$PATH" # spacy link RUN python -m spacy download en_core_web_md && \ python -m spacy download de_core_news_sm && \ python -m spacy download it_core_news_md && \ python -m spacy link en_core_web_md en && \ python -m spacy link it_core_news_md it && \ python -m spacy link de_core_news_sm de # start a new build stage FROM ${IMAGE_BASE_NAME}:base-${BASE_IMAGE_HASH} as runner # copy everything from /opt COPY --from=builder /opt/venv /opt/venv # make sure we use the virtualenv ENV PATH="/opt/venv/bin:$PATH" # set HOME environment variable ENV HOME=/app # update permissions & change user to not run as root WORKDIR /app RUN chgrp -R 0 /app && chmod -R g=u /app && chmod o+wr /app USER 1001 # Create a volume for temporary data VOLUME /tmp # change shell SHELL ["/bin/bash", "-o", "pipefail", "-c"] # the entry point EXPOSE 5005 ENTRYPOINT ["rasa"] CMD ["--help"]