From 719e9b11090083519bbde7b2f13681cd20c2ffb3 Mon Sep 17 00:00:00 2001 From: nobu-g Date: Wed, 4 Aug 2021 18:50:24 +0900 Subject: [PATCH 1/3] add Dockerfile --- Dockerfile | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..504b640b --- /dev/null +++ b/Dockerfile @@ -0,0 +1,53 @@ +FROM debian:latest +WORKDIR /app +ENV DEBIAN_FRONTEND noninteractive +ARG JPP_VERSION=2.0.0-rc3 + +# Japanese +RUN apt-get update \ + && apt-get install -y locales \ + && locale-gen ja_JP.UTF-8 +ENV LANG ja_JP.UTF-8 +ENV LANGUAGE en_US +ENV LC_ALL= +RUN localedef -f UTF-8 -i ja_JP ja_JP.utf8 + +# Install Juman++ +RUN apt-get update && apt-get install -y --no-install-recommends \ + build-essential gcc g++ make cmake libprotobuf-dev wget ca-certificates \ + && wget -q https://github.com/ku-nlp/jumanpp/releases/download/v${JPP_VERSION}/jumanpp-${JPP_VERSION}.tar.xz \ + && tar xf jumanpp-${JPP_VERSION}.tar.xz \ + && cd jumanpp-${JPP_VERSION} \ + && mkdir bld \ + && cd bld \ + && cmake .. -DCMAKE_BUILD_TYPE=Release \ + && make -j "$(nproc)" \ + && make install \ + && cd /app \ + && rm jumanpp-${JPP_VERSION}.tar.xz \ + && rm -rf jumanpp-${JPP_VERSION} + +# Install KNP +RUN apt-get update && apt-get install -y --no-install-recommends \ + zlib1g-dev libtool automake autoconf git unzip \ + && git clone --depth 1 https://github.com/ku-nlp/knp.git \ + && cd knp \ + && ./autogen.sh \ + && wget -q http://lotus.kuee.kyoto-u.ac.jp/nl-resource/knp/dict/latest/knp-dict-latest-bin.zip \ + && unzip knp-dict-latest-bin.zip \ + && cp -ars $(pwd)/dict-bin/* ./dict \ + && ./configure \ + && make -j "$(nproc)" \ + && make install \ + && cd /app \ + && rm -rf knp \ + && apt-get purge -y automake autoconf git unzip wget + +# Clean up all temporary files +RUN apt-get clean \ + && apt-get autoclean -y \ + && apt-get autoremove -y \ + && rm -rf /tmp/* /var/tmp/* \ + && rm -rf /var/lib/apt/lists/* + +CMD /bin/bash From 3bcf6c2805af9d3d78773b5014e8db84ffd7a75b Mon Sep 17 00:00:00 2001 From: nobu-g Date: Fri, 1 Oct 2021 14:59:49 +0900 Subject: [PATCH 2/3] switch base image to debian:latest due to build error --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 504b640b..918947ca 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM debian:latest +FROM ubuntu:latest WORKDIR /app ENV DEBIAN_FRONTEND noninteractive ARG JPP_VERSION=2.0.0-rc3 From 4ed7084e97bbcb52ada12585f0464249bb89f43c Mon Sep 17 00:00:00 2001 From: nobu-g Date: Thu, 7 Oct 2021 18:49:58 +0900 Subject: [PATCH 3/3] fix Dockerfile --- Dockerfile | 53 ++++++++++++++++++++++------------------------------- 1 file changed, 22 insertions(+), 31 deletions(-) diff --git a/Dockerfile b/Dockerfile index 504b640b..5ec21f37 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,36 +1,24 @@ -FROM debian:latest +FROM ubuntu:latest AS builder WORKDIR /app ENV DEBIAN_FRONTEND noninteractive ARG JPP_VERSION=2.0.0-rc3 -# Japanese -RUN apt-get update \ - && apt-get install -y locales \ - && locale-gen ja_JP.UTF-8 -ENV LANG ja_JP.UTF-8 -ENV LANGUAGE en_US -ENV LC_ALL= -RUN localedef -f UTF-8 -i ja_JP ja_JP.utf8 - -# Install Juman++ RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential gcc g++ make cmake libprotobuf-dev wget ca-certificates \ - && wget -q https://github.com/ku-nlp/jumanpp/releases/download/v${JPP_VERSION}/jumanpp-${JPP_VERSION}.tar.xz \ - && tar xf jumanpp-${JPP_VERSION}.tar.xz \ + zlib1g-dev libtool automake autoconf git unzip + +# Build and install Juman++ +RUN wget https://github.com/ku-nlp/jumanpp/releases/download/v${JPP_VERSION}/jumanpp-${JPP_VERSION}.tar.xz -qO - \ + | tar Jxvf - \ && cd jumanpp-${JPP_VERSION} \ && mkdir bld \ && cd bld \ && cmake .. -DCMAKE_BUILD_TYPE=Release \ && make -j "$(nproc)" \ - && make install \ - && cd /app \ - && rm jumanpp-${JPP_VERSION}.tar.xz \ - && rm -rf jumanpp-${JPP_VERSION} + && make install -# Install KNP -RUN apt-get update && apt-get install -y --no-install-recommends \ - zlib1g-dev libtool automake autoconf git unzip \ - && git clone --depth 1 https://github.com/ku-nlp/knp.git \ +# Build and install KNP +RUN git clone --depth 1 https://github.com/ku-nlp/knp.git \ && cd knp \ && ./autogen.sh \ && wget -q http://lotus.kuee.kyoto-u.ac.jp/nl-resource/knp/dict/latest/knp-dict-latest-bin.zip \ @@ -38,16 +26,19 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ && cp -ars $(pwd)/dict-bin/* ./dict \ && ./configure \ && make -j "$(nproc)" \ - && make install \ - && cd /app \ - && rm -rf knp \ - && apt-get purge -y automake autoconf git unzip wget + && make install + +FROM ubuntu:latest AS runner + +# Configure Japanese locale +RUN apt-get update \ + && apt-get install -y locales \ + && locale-gen ja_JP.UTF-8 +ENV LANG="ja_JP.UTF-8" \ + LANGUAGE="en_US" \ + LC_ALL="ja_JP.UTF-8" +RUN localedef -f UTF-8 -i ja_JP ja_JP.utf8 -# Clean up all temporary files -RUN apt-get clean \ - && apt-get autoclean -y \ - && apt-get autoremove -y \ - && rm -rf /tmp/* /var/tmp/* \ - && rm -rf /var/lib/apt/lists/* +COPY --from=builder /usr/local /usr/local CMD /bin/bash