Dockerizing Hatchet Applications
This guide explains how to create Dockerfiles for Hatchet applications. There are examples for both Python and TypeScript applications here.
Entrypoint Configuration for Hatchet
Before creating your Dockerfile, understand that Hatchet workers require specific entry point configuration:
- The entry point must run code that runs the Hatchet worker. This can be done by calling the
worker.start()
method. See the Python SDK docs for more information - Proper environment variables must be set for Hatchet SDK
- The worker should be configured to handle your workflows using the
worker.register
method or by passing workflows into the worker constructor or factory.
Example Dockerfiles
FROM python:3.13-slim
ENV PYTHONUNBUFFERED=1 \
POETRY_VERSION=1.4.2 \
HATCHET_ENV=production
# Install system dependencies and Poetry
RUN apt-get update && \
apt-get install -y curl && \
curl -sSL https://install.python-poetry.org | python3 - && \
ln -s /root/.local/bin/poetry /usr/local/bin/poetry && \
apt-get clean && \
rm -rf /var/lib/apt/lists/\*
WORKDIR /app
COPY pyproject.toml poetry.lock\* /app/
RUN poetry config virtualenvs.create false && \
poetry install --no-interaction --no-ansi
COPY . /app
CMD ["poetry", "run", "python", "worker.py"]
If you’re using a poetry script to run your worker, you can replace poetry run python worker.py
with poetry run <script-name>
in the CMD.