diff --git a/content/docs/09.administrator-guide/02.deployment/01.docker.md b/content/docs/09.administrator-guide/02.deployment/01.docker.md index a44629f47e..5f5a0611cf 100644 --- a/content/docs/09.administrator-guide/02.deployment/01.docker.md +++ b/content/docs/09.administrator-guide/02.deployment/01.docker.md @@ -66,9 +66,10 @@ RUN mkdir -p /app/plugins && \ ``` ### Create a new image with more plugins + By default, the Kestra base docker image does not contain any plugins, you can create a new image from the Kestra base image and add the needed plugins. -The following `DockerFile` creates an image from the Kestra base image and adds the `plugin-notifications`, `storage-gcs` and `plugin-gcp` plugins using the command `kestra plugins install`: +The following `Dockerfile` creates an image from the Kestra base image and adds the `plugin-notifications`, `storage-gcs` and `plugin-gcp` plugins using the command `kestra plugins install`: ```dockerfile ARG IMAGE_TAG=latest @@ -80,6 +81,37 @@ RUN /app/kestra plugins install \ io.kestra.plugin:plugin-gcp:LATEST ``` +The above Dockerfile installs plugins that have already been published to Maven. If you would like to build plugins from a specific Git repository, you can use the following approach: + +```dockerfile +FROM openjdk:17-slim as stage-build +WORKDIR / +USER root + +RUN apt-get update -y +RUN apt-get install git -y && \ + git clone https://github.com/kestra-io/plugin-aws.git + +RUN cd plugin-aws && ./gradlew :shadowJar + +FROM kestra/kestra:latest-full + +# https://github.com/WASdev/ci.docker/issues/194#issuecomment-433519379 +USER root + +RUN mkdir -p /app/plugins && \ + apt-get update -y && \ + apt-get install -y --no-install-recommends golang && \ + apt-get install -y pip && \ + pip install pandas==2.0.3 requests==2.31.0 && \ + apt-get clean && rm -rf /var/lib/apt/lists/* /var/tmp/* + +RUN rm -rf /app/plugins/plugin-aws-*.jar +COPY --from=stage-build /plugin-aws/build/libs/plugin-aws-*.jar /app/plugins +``` + +This multi-stage Docker build allows you to overwrite a plugin that has already been installed. In this example, the AWS plugin is by default already included in the `kestra/kestra:latest-full` image. However, it's overritten by a plugin built in the first Docker build stage. + ### Docker image tags diff --git a/package.json b/package.json index ac039a975b..e1247a737d 100644 --- a/package.json +++ b/package.json @@ -38,4 +38,4 @@ "rss": "^1.2.2", "sass": "^1.64.2" } -} +} \ No newline at end of file