diff --git a/.hadolint.yaml b/.hadolint.yaml new file mode 100644 index 0000000..c7aee47 --- /dev/null +++ b/.hadolint.yaml @@ -0,0 +1,5 @@ +ignored: + - DL3008 # Pin versions in apt get install + - DL3006 # Always tag the version of an image explicitly + - DL3003 # Use WORKDIR to switch to a directory + - DL3013 # Pin versions in pip diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 30bf605..5546bae 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ repos: - id: end-of-file-fixer - id: trailing-whitespace - id: check-yaml - # - repo: https://github.com/hadolint/hadolint - # rev: v2.12.0 - # hooks: - # - id: hadolint + - repo: https://github.com/hadolint/hadolint + rev: v2.12.0 + hooks: + - id: hadolint diff --git a/Dockerfile b/Dockerfile index 53b55f8..b422fd9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,14 +14,16 @@ RUN apt-get update -q && apt-get install -yq --no-install-recommends \ cmake \ libprotobuf-dev \ wget \ - curl \ + tar \ + xz-utils \ ca-certificates \ zlib1g-dev \ libtool \ automake \ autoconf \ git \ - unzip + unzip \ + && apt-get clean && rm -rf /var/lib/apt/lists/* # Build and install Juman++ RUN wget "https://github.com/ku-nlp/jumanpp/releases/download/v${JPP_VERSION}/jumanpp-${JPP_VERSION}.tar.xz" -qO - \ @@ -29,18 +31,19 @@ RUN wget "https://github.com/ku-nlp/jumanpp/releases/download/v${JPP_VERSION}/ju && mkdir "jumanpp-${JPP_VERSION}/bld" \ && cd "jumanpp-${JPP_VERSION}/bld" \ && cmake .. -DCMAKE_BUILD_TYPE=Release \ - && make -j "$(nproc)" \ + && make -j "$([ "$(nproc)" -le 8 ] && nproc || echo "8")" \ && make install # 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 \ +RUN git clone --depth 1 "https://github.com/ku-nlp/knp.git" +WORKDIR /app/knp +RUN ./autogen.sh +RUN 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 \ + && rm -f knp-dict-latest-bin.zip \ && cp -ars "$(pwd)"/dict-bin/* ./dict \ && ./configure \ - && make -j "$(nproc)" \ + && make -j "$([ "$(nproc)" -le 8 ] && nproc || echo "8")" \ && make install FROM ${BASE_IMAGE} AS runner diff --git a/jumanpp-knp.dockerfile b/jumanpp-knp.dockerfile index 4acce5f..120a729 100644 --- a/jumanpp-knp.dockerfile +++ b/jumanpp-knp.dockerfile @@ -23,7 +23,7 @@ RUN apt-get update -q && apt-get install -yq --no-install-recommends \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Build and install KNP -RUN git clone --depth 1 https://github.com/ku-nlp/knp.git +RUN git clone --depth 1 "https://github.com/ku-nlp/knp.git" WORKDIR /app/knp RUN ./autogen.sh RUN wget -q "http://lotus.kuee.kyoto-u.ac.jp/nl-resource/knp/dict/latest/knp-dict-latest-bin.zip" \