2023-08-22 18:35:25 +00:00
|
|
|
ARG PYTHON_VERSION=3.10.0
|
2023-08-20 12:36:30 +00:00
|
|
|
ARG POETRY_VERSION=1.5.0
|
2023-08-20 10:31:49 +00:00
|
|
|
|
|
|
|
FROM python:${PYTHON_VERSION} as staging
|
|
|
|
|
|
|
|
ARG APP_NAME=verbanote
|
|
|
|
ARG APP_PATH=/verbanote
|
|
|
|
ARG PYTHON_VERSION
|
|
|
|
ARG POETRY_VERSION
|
|
|
|
|
|
|
|
ENV \
|
|
|
|
PYTHONDONTWRITEBYTECODE=1 \
|
|
|
|
PYTHONUNBUFFERED=1 \
|
|
|
|
PYTHONFAULTHANDLER=1
|
|
|
|
|
|
|
|
ENV \
|
|
|
|
POETRY_VERSION=${POETRY_VERSION} \
|
|
|
|
POETRY_HOME=/opt/poetry \
|
|
|
|
POETRY_VIRTUALENVS_IN_PROJECT=true \
|
|
|
|
POETRY_NO_INTERACTION=1
|
|
|
|
|
|
|
|
# installing poetry
|
|
|
|
RUN curl -sSL https://install.python-poetry.org | python3 -
|
|
|
|
ENV PATH="${POETRY_HOME}/bin:${PATH}"
|
|
|
|
|
|
|
|
WORKDIR ${APP_PATH}
|
2023-08-21 16:51:49 +00:00
|
|
|
COPY ./poetry.lock ./pyproject.toml ./README.md ./
|
2023-08-20 10:31:49 +00:00
|
|
|
|
2023-08-22 18:34:12 +00:00
|
|
|
WORKDIR ${APP_PATH}
|
|
|
|
RUN poetry install
|
|
|
|
|
2023-08-20 10:31:49 +00:00
|
|
|
# --------------
|
|
|
|
|
2023-08-22 18:35:25 +00:00
|
|
|
FROM ghcr.io/pytorch/pytorch-nightly:668af07-cu11.8.0 as worker
|
|
|
|
|
2023-08-21 16:52:18 +00:00
|
|
|
ARG APP_NAME=verbanote
|
|
|
|
ARG APP_PATH=/verbanote
|
2023-08-22 12:27:52 +00:00
|
|
|
ARG VERBANOTE_OUTPUT_PATH=/out
|
|
|
|
ARG VERBANOTE_INPUT_PATH=/in
|
2023-08-20 10:31:49 +00:00
|
|
|
ENV APP_NAME=${APP_NAME}
|
|
|
|
ENV APP_PATH=${APP_PATH}
|
|
|
|
ENV VERBANOTE_OUTPUT_PATH=${VERBANOTE_OUTPUT_PATH}
|
2023-08-22 12:27:52 +00:00
|
|
|
ENV VERBANOTE_INPUT_PATH=${VERBANOTE_INPUT_PATH}
|
2023-08-22 18:34:12 +00:00
|
|
|
ENV VIRTUAL_ENV="${APP_PATH}/.venv"
|
|
|
|
ENV PATH="${APP_PATH}/.venv/bin:${PATH}"
|
|
|
|
|
|
|
|
COPY --from=staging ${APP_PATH} ${APP_PATH}
|
2023-08-20 10:31:49 +00:00
|
|
|
|
2023-08-22 12:27:52 +00:00
|
|
|
RUN mkdir -p ${VERBANOTE_INPUT_PATH}
|
2023-08-22 08:02:08 +00:00
|
|
|
RUN mkdir -p ${VERBANOTE_OUTPUT_PATH}
|
|
|
|
|
2023-08-21 16:51:23 +00:00
|
|
|
# installing the large models
|
2023-08-22 18:34:12 +00:00
|
|
|
RUN rm "${VIRTUAL_ENV}/bin/python"
|
|
|
|
RUN ln -s "/opt/conda/bin/python" "${VIRTUAL_ENV}/bin/python"
|
|
|
|
RUN which python
|
2023-08-23 11:22:55 +00:00
|
|
|
RUN ltt install --pytorch-computation-backend=cu117 torch==1.13.1 torchvision==0.14.1 torchaudio==0.13.1
|
2023-08-21 16:51:23 +00:00
|
|
|
|
2023-08-22 08:02:08 +00:00
|
|
|
COPY ./${APP_NAME} ./${APP_NAME}
|
|
|
|
|
2023-08-20 10:31:49 +00:00
|
|
|
COPY ./docker/docker-entrypoint.sh /docker-entrypoint.sh
|
|
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
|
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
2023-08-22 08:47:51 +00:00
|
|
|
CMD [ "python", "-u", "verbanote/rp_handler.py" ]
|