0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

JUMAN++をPythonでDocker内で動かす

Last updated at Posted at 2024-07-21

はじめに

Media of Langueを開発する過程でJUMAN++をDocker内で動かしたくなったのでメモ。
ちなみにJUMAN++はバージョン2系列の方が早いのでこちらを使っていきます。

Dockerfile

今回使ったDockerfileをもとにしているので適時変更してください。
(srcディレクトリがないとエラーが出ます)

FROM nvidia/cuda:11.6.2-base-ubuntu20.04
ARG SRCDIR=/src
RUN export LC_ALL=C.UTF-8
RUN export LANG=C.UTF-8
RUN apt-get update -y && \
    apt-get upgrade -y && \
    apt-get install -y \
    locales \
    locales-all \
    g++ \
    wget \
    clang \
    cmake \
    xz-utils && \
    locale-gen ja_JP.UTF-8 && \
    echo "export LANG=ja_JP.UTF-8" >> ~/.bashrc 
RUN apt-get install -y python3 python3-pip
RUN pip3 install --upgrade pip
RUN pip3 install pyknp
RUN wget https://github.com/ku-nlp/jumanpp/releases/download/v2.0.0-rc3/jumanpp-2.0.0-rc3.tar.xz 
RUN tar xvf jumanpp-2.0.0-rc3.tar.xz 
WORKDIR jumanpp-2.0.0-rc3 
RUN mkdir bld 
WORKDIR bld 
RUN cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local 
RUN make install -j 4
WORKDIR ${SRCDIR}
COPY .${SRCDIR} /root/src/

CMD [ "/bin/bash" ]

docker-compose.yml

docker-compose.yml
version: '3'
services:
    jumanpp:
        image: jumanpp
        container_name: jumanpp
        command:
            - /bin/bash
        build:
            context: .
            dockerfile: ./Dockerfile
        working_dir: /root/
        tty: true
        restart: always
        env_file:
            - ./.env
        environment:
            - LANG=${LANG}
            - LANGUAGE=${LANGUAGE}
            - LC_ALL=${LC_ALL}
            - TZ=${TZ}
            - TERM=${TERM}

最後に

誰かが詰まった時の助けになれば幸いです。
Media of Langueプロジェクトでも私が代表をしているEngineeでもエンジニアを探しています。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?