Marty Oehme
3246469be2
Since I can't build cuda images locally (without nvidia gpu), we make use of an existing one. That also means downgrading python to Debian's version 3.10.
63 lines
1.6 KiB
Docker
63 lines
1.6 KiB
Docker
ARG PYTHON_VERSION=3.10.0
|
|
ARG POETRY_VERSION=1.5.0
|
|
|
|
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}
|
|
COPY ./poetry.lock ./pyproject.toml ./README.md ./
|
|
|
|
WORKDIR ${APP_PATH}
|
|
RUN poetry install
|
|
|
|
# --------------
|
|
|
|
FROM ghcr.io/pytorch/pytorch-nightly:668af07-cu11.8.0 as worker
|
|
|
|
ARG APP_NAME=verbanote
|
|
ARG APP_PATH=/verbanote
|
|
ARG VERBANOTE_OUTPUT_PATH=/out
|
|
ARG VERBANOTE_INPUT_PATH=/in
|
|
ENV APP_NAME=${APP_NAME}
|
|
ENV APP_PATH=${APP_PATH}
|
|
ENV VERBANOTE_OUTPUT_PATH=${VERBANOTE_OUTPUT_PATH}
|
|
ENV VERBANOTE_INPUT_PATH=${VERBANOTE_INPUT_PATH}
|
|
ENV VIRTUAL_ENV="${APP_PATH}/.venv"
|
|
ENV PATH="${APP_PATH}/.venv/bin:${PATH}"
|
|
|
|
COPY --from=staging ${APP_PATH} ${APP_PATH}
|
|
|
|
RUN mkdir -p ${VERBANOTE_INPUT_PATH}
|
|
RUN mkdir -p ${VERBANOTE_OUTPUT_PATH}
|
|
|
|
# installing the large models
|
|
RUN rm "${VIRTUAL_ENV}/bin/python"
|
|
RUN ln -s "/opt/conda/bin/python" "${VIRTUAL_ENV}/bin/python"
|
|
RUN which python
|
|
RUN ltt install --pytorch-computation-backend=cu117 torch torchvision torchaudio
|
|
|
|
COPY ./${APP_NAME} ./${APP_NAME}
|
|
|
|
COPY ./docker/docker-entrypoint.sh /docker-entrypoint.sh
|
|
RUN chmod +x /docker-entrypoint.sh
|
|
ENTRYPOINT [ "/docker-entrypoint.sh" ]
|
|
CMD [ "python", "-u", "verbanote/rp_handler.py" ]
|