diff --git a/docker/Dockerfile.centos-7.9.2009 b/docker/Dockerfile.centos-7.9.2009 index a449688..b8a4ede 100644 --- a/docker/Dockerfile.centos-7.9.2009 +++ b/docker/Dockerfile.centos-7.9.2009 @@ -1,41 +1,41 @@ -FROM centos:7.9.2009 AS base - -# install base packages -RUN yum -y install glibc-langpack-en glibc-langpack-ko python3 python3-pip -RUN pip3 install --upgrade pip wheel - -# branch to build khaiii -FROM base AS build -RUN yum -y groupinstall "Development Tools" && \ - yum -y install centos-release-scl && \ - yum -y install devtoolset-7 -RUN pip3 install cmake -COPY . /khaiii -WORKDIR /khaiii/build -RUN source /opt/rh/devtoolset-7/enable && \ - cmake .. && \ - make -j && \ - make resource && \ - test/khaiii && \ - make install && \ - make package_python -WORKDIR /khaiii/build/package_python -RUN source /opt/rh/devtoolset-7/enable && \ - pip3 install . - -# branch to run khaiii -FROM base AS runtime -COPY --from=build /usr/local/bin/khaiii /usr/local/bin/ -COPY --from=build /usr/local/lib/libkhaiii.* /usr/local/lib/ -COPY --from=build /usr/local/share/khaiii/ /usr/local/share/khaiii/ -COPY --from=build /usr/local/include/khaiii/ /usr/local/include/khaiii/ - -ENV PYTHON_VER=3.6 -ARG KHAIII_VER -RUN echo "KHAIII_VER: ${KHAIII_VER}" -RUN if [ "${KHAIII_VER}" = "" ]; then echo "build argument KHAIII_VER is not provided" && exit 1; fi -COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ -COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ - -ENV LANG=en_US.UTF-8 -WORKDIR / +FROM centos:7.9.2009 AS base + +# install base packages +RUN yum -y install glibc-langpack-en glibc-langpack-ko python3 python3-pip +RUN pip3 install --upgrade pip wheel + +# branch to build khaiii +FROM base AS build +RUN yum -y groupinstall "Development Tools" && \ + yum -y install centos-release-scl && \ + yum -y install devtoolset-7 +RUN pip3 install cmake +COPY . /khaiii +WORKDIR /khaiii/build +RUN source /opt/rh/devtoolset-7/enable && \ + cmake .. && \ + make -j && \ + make resource && \ + test/khaiii && \ + make install && \ + make package_python +WORKDIR /khaiii/build/package_python +RUN source /opt/rh/devtoolset-7/enable && \ + pip3 install . + +# branch to run khaiii +FROM base AS runtime +COPY --from=build /usr/local/bin/khaiii /usr/local/bin/ +COPY --from=build /usr/local/lib/libkhaiii.* /usr/local/lib/ +COPY --from=build /usr/local/share/khaiii/ /usr/local/share/khaiii/ +COPY --from=build /usr/local/include/khaiii/ /usr/local/include/khaiii/ + +ENV PYTHON_VER=3.6 +ARG KHAIII_VER +RUN echo "KHAIII_VER: ${KHAIII_VER}" +RUN if [ "${KHAIII_VER}" = "" ]; then echo "build argument KHAIII_VER is not provided" && exit 1; fi +COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ +COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ + +ENV LANG=en_US.UTF-8 +WORKDIR / diff --git a/docker/Dockerfile.centos-8.3.2011 b/docker/Dockerfile.centos-8.3.2011 index 8b0b29a..52d98cc 100644 --- a/docker/Dockerfile.centos-8.3.2011 +++ b/docker/Dockerfile.centos-8.3.2011 @@ -1,37 +1,37 @@ -FROM centos:8.3.2011 AS base - -# install base packages -RUN yum -y install glibc-langpack-en glibc-langpack-ko python3 python3-pip -RUN pip3 install --upgrade pip wheel - -# branch to build khaiii -FROM base AS build -RUN yum -y groupinstall "Development Tools" -RUN pip3 install cmake -COPY . /khaiii -WORKDIR /khaiii/build -RUN cmake .. && \ - make -j && \ - make resource && \ - test/khaiii && \ - make install && \ - make package_python -WORKDIR /khaiii/build/package_python -RUN pip3 install . - -# branch to run khaiii -FROM base AS runtime -COPY --from=build /usr/local/bin/khaiii /usr/local/bin/ -COPY --from=build /usr/local/lib/libkhaiii.* /usr/local/lib/ -COPY --from=build /usr/local/share/khaiii/ /usr/local/share/khaiii/ -COPY --from=build /usr/local/include/khaiii/ /usr/local/include/khaiii/ - -ENV PYTHON_VER=3.6 -ARG KHAIII_VER -RUN echo "KHAIII_VER: ${KHAIII_VER}" -RUN if [ "${KHAIII_VER}" = "" ]; then echo "build argument KHAIII_VER is not provided" && exit 1; fi -COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ -COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ - -ENV LANG=ko_KR.UTF-8 -WORKDIR / +FROM centos:8.3.2011 AS base + +# install base packages +RUN yum -y install glibc-langpack-en glibc-langpack-ko python3 python3-pip +RUN pip3 install --upgrade pip wheel + +# branch to build khaiii +FROM base AS build +RUN yum -y groupinstall "Development Tools" +RUN pip3 install cmake +COPY . /khaiii +WORKDIR /khaiii/build +RUN cmake .. && \ + make -j && \ + make resource && \ + test/khaiii && \ + make install && \ + make package_python +WORKDIR /khaiii/build/package_python +RUN pip3 install . + +# branch to run khaiii +FROM base AS runtime +COPY --from=build /usr/local/bin/khaiii /usr/local/bin/ +COPY --from=build /usr/local/lib/libkhaiii.* /usr/local/lib/ +COPY --from=build /usr/local/share/khaiii/ /usr/local/share/khaiii/ +COPY --from=build /usr/local/include/khaiii/ /usr/local/include/khaiii/ + +ENV PYTHON_VER=3.6 +ARG KHAIII_VER +RUN echo "KHAIII_VER: ${KHAIII_VER}" +RUN if [ "${KHAIII_VER}" = "" ]; then echo "build argument KHAIII_VER is not provided" && exit 1; fi +COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii/ +COPY --from=build /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ /usr/local/lib/python${PYTHON_VER}/site-packages/khaiii-${KHAIII_VER}.dist-info/ + +ENV LANG=ko_KR.UTF-8 +WORKDIR / diff --git a/docker/Dockerfile.pytorch b/docker/Dockerfile.pytorch index 4cb7d3a..83a46c8 100644 --- a/docker/Dockerfile.pytorch +++ b/docker/Dockerfile.pytorch @@ -1,8 +1,8 @@ -FROM pytorch/pytorch:1.7.0-cuda11.0-cudnn8-runtime - -RUN pip install tensorboardX tqdm -COPY . /khaiii -WORKDIR /khaiii/train -ENV PYTHONPATH=/khaiii/src/main/python -RUN python split_corpus.py --input corpus/sample.txt --out-pfx corpus/sample --dev 4 --test 4 -RUN python train.py --in-pfx corpus/sample --batch-size 4 +FROM pytorch/pytorch:1.7.0-cuda11.0-cudnn8-runtime + +RUN pip install tensorboardX tqdm +COPY . /khaiii +WORKDIR /khaiii/train +ENV PYTHONPATH=/khaiii/src/main/python +RUN python split_corpus.py --input corpus/sample.txt --out-pfx corpus/sample --dev 4 --test 4 +RUN python train.py --in-pfx corpus/sample --batch-size 4 diff --git a/docker/Dockerfile.ubuntu b/docker/Dockerfile.ubuntu index ea378c6..73e1334 100644 --- a/docker/Dockerfile.ubuntu +++ b/docker/Dockerfile.ubuntu @@ -1,52 +1,52 @@ -ARG UBUNTU_VER="18.04" -FROM ubuntu:${UBUNTU_VER} AS base -# supported ubuntu versions are 20.04, 18.04 and 16.04 -# you can build with passing --build-arg argument, such as "--build-arg UBUNTU_VER=20.04" - -# install base packages -RUN apt -y update && \ - apt -y install language-pack-ko python3 python3-pip -RUN locale-gen en_US.UTF-8 && \ - update-locale LANG=en_US.UTF-8 -RUN pip3 install --upgrade pip - -# branch to build khaiii -FROM base AS build -RUN apt -y install build-essential -RUN pip3 install cmake -COPY . /khaiii -WORKDIR /khaiii/build -RUN cmake .. && \ - make -j && \ - make resource && \ - test/khaiii && \ - make install && \ - make package_python -WORKDIR /khaiii/build/package_python -RUN pip3 install . - -# branch to run khaiii -FROM base AS runtime -COPY --from=build /usr/local/bin/khaiii /usr/local/bin/ -COPY --from=build /usr/local/lib/libkhaiii.* /usr/local/lib/ -COPY --from=build /usr/local/share/khaiii/ /usr/local/share/khaiii/ -COPY --from=build /usr/local/include/khaiii/ /usr/local/include/khaiii/ - -FROM runtime AS ubuntu-16.04 -ENV PYTHON_VER=3.5 - -FROM runtime AS ubuntu-18.04 -ENV PYTHON_VER=3.6 - -FROM runtime AS ubuntu-20.04 -ENV PYTHON_VER=3.8 - -FROM ubuntu-${UBUNTU_VER} -ARG KHAIII_VER -RUN echo "KHAIII_VER: ${KHAIII_VER}" -RUN if [ "${KHAIII_VER}" = "" ]; then echo "build argument KHAIII_VER is not provided" && exit 1; fi -COPY --from=build /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii/ /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii/ -COPY --from=build /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii-${KHAIII_VER}.dist-info/ /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii-${KHAIII_VER}.dist-info/ - -ENV LANG=ko_KR.UTF-8 -WORKDIR / +ARG UBUNTU_VER="18.04" +FROM ubuntu:${UBUNTU_VER} AS base +# supported ubuntu versions are 20.04, 18.04 and 16.04 +# you can build with passing --build-arg argument, such as "--build-arg UBUNTU_VER=20.04" + +# install base packages +RUN apt -y update && \ + apt -y install language-pack-ko python3 python3-pip +RUN locale-gen en_US.UTF-8 && \ + update-locale LANG=en_US.UTF-8 +RUN pip3 install --upgrade pip + +# branch to build khaiii +FROM base AS build +RUN apt -y install build-essential +RUN pip3 install cmake +COPY . /khaiii +WORKDIR /khaiii/build +RUN cmake .. && \ + make -j && \ + make resource && \ + test/khaiii && \ + make install && \ + make package_python +WORKDIR /khaiii/build/package_python +RUN pip3 install . + +# branch to run khaiii +FROM base AS runtime +COPY --from=build /usr/local/bin/khaiii /usr/local/bin/ +COPY --from=build /usr/local/lib/libkhaiii.* /usr/local/lib/ +COPY --from=build /usr/local/share/khaiii/ /usr/local/share/khaiii/ +COPY --from=build /usr/local/include/khaiii/ /usr/local/include/khaiii/ + +FROM runtime AS ubuntu-16.04 +ENV PYTHON_VER=3.5 + +FROM runtime AS ubuntu-18.04 +ENV PYTHON_VER=3.6 + +FROM runtime AS ubuntu-20.04 +ENV PYTHON_VER=3.8 + +FROM ubuntu-${UBUNTU_VER} +ARG KHAIII_VER +RUN echo "KHAIII_VER: ${KHAIII_VER}" +RUN if [ "${KHAIII_VER}" = "" ]; then echo "build argument KHAIII_VER is not provided" && exit 1; fi +COPY --from=build /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii/ /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii/ +COPY --from=build /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii-${KHAIII_VER}.dist-info/ /usr/local/lib/python${PYTHON_VER}/dist-packages/khaiii-${KHAIII_VER}.dist-info/ + +ENV LANG=ko_KR.UTF-8 +WORKDIR /