Your Dockerfile should follow these guidelines for compatibility with Blaxel’s infrastructure:
Python
Copy
Ask AI
# Start from a base Python imageFROM python:3.12-slim# Set working directoryWORKDIR /blaxel# Install system dependencies (if needed)RUN apt-get update && apt-get install -y \\ build-essential \\ # Add any other system dependencies here \\ && rm -rf /var/lib/apt/lists/*# Copy requirements first for better cachingCOPY pyproject.toml uv.lock /blaxel/RUN pip install uv && uv sync --refresh# Copy application codeCOPY . .# Set env variable to use the virtual environmentENV PATH="/blaxel/python/.venv/bin:$PATH"# Command to run when container starts, it need to provide a server running on port 80 for agent and MCP serverENTRYPOINT [".venv/bin/python3", "-m", "src"]
TypeScript/JavaScript
Copy
Ask AI
# Start from a Node.js base imageFROM node:22-alpine# Set working directoryWORKDIR /blaxel# Copy package files for better cachingCOPY package.json pnpm-lock.yaml /blaxel/RUN npx pnpm install# Copy application codeCOPY . .# Command to run when container starts, it need to provide a server running on port 80 for agent and MCP serverENTRYPOINT ["npx", "pnpm", "start"]
The entrypoint must start a server running on port 80 for agents and MCP servers.For batch jobs, the entrypoint must run a function that terminates—if it runs infinitely, your job will continue until it hits the execution timeout.
Environment variables configured in the Blaxel platform will be automatically injected into your container at runtime. You do not need to specify them in your Dockerfile.
When a Dockerfile is present at the root of your project, Blaxel will use it to build a custom container image for your deployment. Deploy your application with the Blaxel CLI as usual.