Custom script in tyk go plugin compiler


Is it possible to put some custom script when build go plugin using Docker?

In my case I want to change the value of some variable in my plugin through flags depend on the target environment, i.e testing, staging, production. I’m thinking to enable to do that is to customize the script that runs inside the tyk plugin compiler Docker image, is it possible? and how do that?

Also I have tried to build my own docker image using the dockerfile in tyk github repositories, but it always fails.

Thank you

Hi @Raka and welcome to the community.

Is it possible to put some custom script when build go plugin using Docker?

It’s really easy to do this!

Simply take the published plugin compiler image and build from that.

If I create a Dockerfile like this

$ cat Dockerfile 
FROM tykio/tyk-plugin-compiler:v5.0.1

RUN chmod +x /


Then provide a that does what I want and build an image like this:

$ docker build --tag myplugincompiler:v5.0.1 .

I’ll then have an image that contains the script and will run it when invoked.


I’m trying to build the Customer Go Plugin from the tutorial using the latest Docker image, and I’m getting some errors relating to it using Go version 1.23 instead of the version 1.21.3 used in the plugin. I tried switching to 1.23 in the go.mod but it just says tyk-plugin: cannot compile Go 1.23 code

I don’t know Go much at all. I was just trying to hack and slash my way through to test the custom functionality. We also don’t have a license key the tutorial is asking for

Any ideas?