Skip to content

Commit

Permalink
Overwrite a plugin in a multi-stage build (#487)
Browse files Browse the repository at this point in the history
* Overwrite a plugin in a multi-stage build

* Update 01.docker.md

* chore(deps): update all dependencies

* main conflict

---------

Co-authored-by: Ludovic DEHON <[email protected]>
  • Loading branch information
anna-geller and tchiotludo authored Sep 11, 2023
1 parent 5ac190d commit bce6dca
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
34 changes: 33 additions & 1 deletion content/docs/09.administrator-guide/02.deployment/01.docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@
"rss": "^1.2.2",
"sass": "^1.64.2"
}
}
}

1 comment on commit bce6dca

@vercel
Copy link

@vercel vercel bot commented on bce6dca Sep 11, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

kestra-io – ./

kestra-io.vercel.app
kestra-io-kestra.vercel.app
kestra-io-git-main-kestra.vercel.app

Please sign in to comment.