There are solutions, time consuming though. It requires you to be selfhosted.
Merge your third party docker image with an openruntime image
If you are not on ARM you can use https://github.com/bergkvist/includeimage which worked well for me
otherwise you can create a Dockerfile with something like
FROM openruntimes/node:v2-16.0 FROM myrep/myimage COPY --from=0 / /
it works but it creates a large image
or you can manually create a new Dockerfile adding the things you need (more complicated)
in order for appwrite to use this new image as a base image for running functions you need to tag it with the same tag
in my example it would be openruntimes/node:v2-16.0
then you can call your command on your custom container with the child_process node package
inside an appwrite nodejs cloud function
the other solutions I would think of is to create a REST service on your private docker container with the technology you prefer so you can access via http from your cloud function
a last option is to dive into the guts of appwrite executor source code ( php) and tweak things there so you can run a command directly on your container. You will end up with a good knowledge of appwrites container orchestration and flexibility to do what you want at the very low level but it might be time consuming and the risks to break things are high I think
Function to call a docker container? What exactly do you mean? And are you on cloud?
No. On self hosted environment. Someone provides me a closed docker container with the functionality I want to use in my function.
It is not all the time running, just one-shot-style of a private algorithm.
This would be interesting, not sure whether they will provide me access to the the dockerfile, and also would complicate the CI/CD a lot, but I will keep it in mind
It sounds the most reasonable, I should double check whether I can see it in the same network or how isolated is the function call from the local system.
How exactly are you supposed to use this docker image?
Get params via rest API, if I have to use the command line, execute docker command with those, wait to end, save on database the result
Rest API nice. So you'll need to host that somewhere and then your Appwrite function can make an http request to it
So, no direct support, I guess I should code it myself
I would have expected a special kind of function which does that lifting for me, takes care of the warmup times, stores results, etc
Well thank you
Appwrite functions do that but you have to implement an Appwrite function: https://appwrite.io/docs/functions#writingYourOwnFunction
We don't support running an arbitrary docker image if that's what you were looking for
Well, exactly that. I guess it will be tricky to preinitialize it… thank you for the support
Recommended threads
- HTTP POST to function returning "No Appw...
Hi everyone, I’m running into an issue with my self-hosted Appwrite instance. I’ve set up my environment variables (APPWRITE_FUNCTION_PROJECT_ID, APPWRITE_FUNC...
- Can't add dart 3.5 runtime
Modified the `.env` to enable dart 3.5 runtime on my self-hosted instance but still can't find the runtime when creating a new function. I manually pulled the i...
- How to verify an user using AppWrite Fun...
I have seen similar questions but none whose solutions serve me. I have a function to verify a user with their secret and their id: https://blahblah.appwrite.gl...