Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: docker worker entry point #1

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
!datashare-spacy-worker
datashare-spacy-worker/spacy_worker/tests
!data/models.json
!scripts
14 changes: 7 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# syntax=docker/dockerfile:1
FROM python:3.11-slim-bullseye AS worker-base
ARG n_workers
ENV HOME=/home/user
ENV ICIJ_WORKER_TYPE=amqp

Expand All @@ -14,21 +13,22 @@ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="$HOME/.cargo/bin:$PATH"

WORKDIR $HOME/src/app
ADD scripts ./scripts/
ADD datashare-spacy-worker/ ./datashare-spacy-worker/
ADD data/models.json ./datashare-spacy-worker/spacy_worker/data/
WORKDIR $HOME/src/app/datashare-spacy-worker

FROM worker-base AS worker

ARG n_workers
ENV N_PROCESSING_WORKERS $n_workers
RUN --mount=type=cache,target=~/.cache/pypoetry poetry install
RUN rm -rf ~/.cache/pip ~/.cache/pypoetry/cache ~/.cache/pypoetry/artifacts
# TODO: add a namespace
ENTRYPOINT poetry run python -m icij_worker workers start spacy_worker.app.app -n ${n_workers:-1}
ENTRYPOINT ["/home/user/src/app/scripts/worker_entrypoint.sh"]


FROM worker-base AS worker-transformers

ARG n_workers
ENV N_PROCESSING_WORKERS $n_workers
RUN --mount=type=cache,target=~/.cache/pypoetry poetry install -E transformers
RUN rm -rf ~/.cache/pip ~/.cache/pypoetry/cache ~/.cache/pypoetry/artifacts
# TODO: add a namespace
ENTRYPOINT poetry run python -m icij_worker workers start spacy_worker.app.app -n ${n_workers:-1}
ENTRYPOINT ["/home/user/src/app/scripts/worker_entrypoint.sh"]
Loading