From f94892f0823f05b26f73e4c567047415cb616a49 Mon Sep 17 00:00:00 2001 From: Shynamo Date: Wed, 24 May 2023 22:36:29 +0200 Subject: [PATCH 1/6] Add Dockerfile --- Dockerfile | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..630aa29d --- /dev/null +++ b/Dockerfile @@ -0,0 +1,23 @@ +# Temporary image to download the package +FROM maven:3.8 as builder + +ADD . /build +WORKDIR /build + +RUN apt-get update \ + && apt install -y python3 \ + && ln -s /usr/bin/python3 /usr/bin/python +RUN python3 tools/createCompletionLists.py && mvn verify \ + && VERSION=$(grep ".*" pom.xml | head -n1 | cut -d '>' -f 2 | cut -d '<' -f 1) \ + && cd target \ + && tar xvf ltex-ls-${VERSION}.tar.gz \ + && mv ltex-ls-${VERSION} /app \ + && rm /app/bin/*.bat \ + && find /app -maxdepth 1 -type f -not -name LICENSE.md -delete + +# Actual image +FROM openjdk:slim + +WORKDIR /app/bin +COPY --from=builder /app /app +ENTRYPOINT [ "./ltex-cli" ] From 12476b8f5e4cc4ef2e178f7be7f056fb1c438916 Mon Sep 17 00:00:00 2001 From: Shynamo Date: Wed, 24 May 2023 22:42:10 +0200 Subject: [PATCH 2/6] Add Dockerfile using release download Pull a package from the official platform-independent release 16.0.0 by default to build an image without having to clone the repository --- container/Dockerfile | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 container/Dockerfile diff --git a/container/Dockerfile b/container/Dockerfile new file mode 100644 index 00000000..edcc6eb1 --- /dev/null +++ b/container/Dockerfile @@ -0,0 +1,20 @@ +# Temporary image to download the package +FROM ubuntu:latest as downloader + +ARG VERSION=16.0.0 +RUN apt update \ + && apt install -y curl tar \ + && curl https://github.com/valentjn/ltex-ls/releases/download/${VERSION}/ltex-ls-${VERSION}.tar.gz \ + --location \ + --output ltex-ls-${VERSION}.tar.gz \ + && tar xvf ltex-ls-${VERSION}.tar.gz \ + && mv ltex-ls-${VERSION} /app \ + && rm /app/bin/*.bat \ + && find /app -maxdepth 1 -type f -not -name LICENSE.md -delete + +# Actual image +FROM openjdk:slim + +WORKDIR /app/bin +COPY --from=downloader /app /app +ENTRYPOINT [ "./ltex-cli" ] From 9fa155ef28d26bb99e8085d4f2b58eddd99f7988 Mon Sep 17 00:00:00 2001 From: Shynamo Date: Wed, 24 May 2023 23:05:32 +0200 Subject: [PATCH 3/6] Remove useless container/Dockerfile --- container/Dockerfile | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100644 container/Dockerfile diff --git a/container/Dockerfile b/container/Dockerfile deleted file mode 100644 index edcc6eb1..00000000 --- a/container/Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -# Temporary image to download the package -FROM ubuntu:latest as downloader - -ARG VERSION=16.0.0 -RUN apt update \ - && apt install -y curl tar \ - && curl https://github.com/valentjn/ltex-ls/releases/download/${VERSION}/ltex-ls-${VERSION}.tar.gz \ - --location \ - --output ltex-ls-${VERSION}.tar.gz \ - && tar xvf ltex-ls-${VERSION}.tar.gz \ - && mv ltex-ls-${VERSION} /app \ - && rm /app/bin/*.bat \ - && find /app -maxdepth 1 -type f -not -name LICENSE.md -delete - -# Actual image -FROM openjdk:slim - -WORKDIR /app/bin -COPY --from=downloader /app /app -ENTRYPOINT [ "./ltex-cli" ] From 98d6311681330670dcd6724027e4994887a44233 Mon Sep 17 00:00:00 2001 From: Shynamo Date: Wed, 24 May 2023 23:47:43 +0200 Subject: [PATCH 4/6] Use absolute path for ltex-cli --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 630aa29d..3b5c5f4e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -20,4 +20,4 @@ FROM openjdk:slim WORKDIR /app/bin COPY --from=builder /app /app -ENTRYPOINT [ "./ltex-cli" ] +ENTRYPOINT [ "/app/bin/ltex-cli" ] From a61771f7c097a5a95f0ec2629fc9debd563b57b7 Mon Sep 17 00:00:00 2001 From: Shynamo Date: Thu, 25 May 2023 00:08:21 +0200 Subject: [PATCH 5/6] Allow the use of ltex-ls and ltex-cli through CLI --- Dockerfile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b5c5f4e..3b3d0adb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -18,6 +18,7 @@ RUN python3 tools/createCompletionLists.py && mvn verify \ # Actual image FROM openjdk:slim +ENV PATH="${PATH}:/app/bin" WORKDIR /app/bin COPY --from=builder /app /app -ENTRYPOINT [ "/app/bin/ltex-cli" ] +CMD [ "echo", "Usage: 'ltex-ls [PARAMS]' or 'ltex-ls [PARAMS]'. A directory must be mounted to analyse files using ltex-cli." ] From 255d564dbb044eab0ced8e17c0992c002f76b9b0 Mon Sep 17 00:00:00 2001 From: Baptiste ROSEAU <33978467+Shynamo@users.noreply.github.com> Date: Thu, 25 May 2023 02:47:06 -0700 Subject: [PATCH 6/6] Fix typo in Dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3b3d0adb..b69b8d4c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -21,4 +21,4 @@ FROM openjdk:slim ENV PATH="${PATH}:/app/bin" WORKDIR /app/bin COPY --from=builder /app /app -CMD [ "echo", "Usage: 'ltex-ls [PARAMS]' or 'ltex-ls [PARAMS]'. A directory must be mounted to analyse files using ltex-cli." ] +CMD [ "echo", "Usage: 'ltex-ls [PARAMS]' or 'ltex-cli [PARAMS]'. A directory must be mounted to analyse files using ltex-cli." ]