rubenf
rubenf9mo ago

how does one preinstall binaries

@Ask Inkeep how does one preinstall binaries
3 Replies
Ask Inkeep
Ask Inkeep9mo ago
Thanks for tagging me @rubenf. I'll look through relevant sources and get back to you shortly. ----------------------------- While I generate an answer, here are some sources that might be helpful: * Preinstall Binaries * Workers and Worker Groups * Core Concepts * feature: Improve packaging/distribution of components? -----------------------------
Ask Inkeep
Ask Inkeep9mo ago
Answer To preinstall binaries in Windmill, you have two main approaches: extending the base Docker image or using init scripts. 1. Extending the base Docker image: You can create a custom Docker image by extending the base image provided by Windmill and then use apt or other package managers to install the binaries you need. Here’s an example Dockerfile snippet for installing Node.js and npm packages:
FROM ghcr.io/windmill-labs/windmill:main
RUN apt-get update && apt install -y nodejs npm
RUN npm install -g your-package
CMD ["windmill"]

FROM ghcr.io/windmill-labs/windmill:main
RUN apt-get update && apt install -y nodejs npm
RUN npm install -g your-package
CMD ["windmill"]

(1) 2. Using init scripts: Init scripts are executed at the beginning when the worker starts, allowing you to install binaries or set initial configurations without modifying the base image. You can set these scripts from the Worker Management UI at the worker group level. Here is an example init script for installing Playwright via pip:
pip install playwright
export PATH=$PATH:/tmp/.local/bin
playwright install
playwright install-deps

pip install playwright
export PATH=$PATH:/tmp/.local/bin
playwright install
playwright install-deps

(2) (3) These binaries are then available for use in your Windmill scripts and flows. Remember that the init scripts are executed every time a worker starts, while extending the base Docker image is a one-time setup that persists across worker restarts.
Ask Inkeep
Ask Inkeep9mo ago
Feel free to tag me @Ask Inkeep for any follow-ups. Also appreciate any feedback, it helps me improve.