---
title: "Generate a Dockerfile from a preset"
method: POST
path: "/presets/{slug}/dockerfile"
tags: ["Presets"]
---

# Generate a Dockerfile from a preset

`POST /presets/{slug}/dockerfile`

## Request

- Base URL: `/api` (relative, and the document was published on a file host, not at the API’s origin)
- URL: `/api/presets/{slug}/dockerfile`
- Auth: HTTP bearer

Returns the Dockerfile content and build arguments for a given preset slug.
The CLI can use this to build Docker images locally without needing a Dockerfile
in the project directory, enabling zero-config deployments.

## Path parameters

- `slug` string, required

## Request body

- GenerateDockerfileRequest: Request body for generating a Dockerfile from a preset
  - `build_command` string, nullable: Custom build command (overrides preset default)
  - `install_command` string, nullable: Custom install command (overrides preset default)
  - `output_dir` string, nullable: Output directory for static builds
  - `package_manager` string, nullable: Package manager used by the project (npm, yarn, pnpm, bun) If not provided, defaults to npm
  - `project_name` string, nullable: Project name/slug used for container naming
  - `use_buildkit` boolean: Whether to use BuildKit cache mounts for faster builds

## Response `200`

Generated Dockerfile

- GenerateDockerfileResponse: Response containing a generated Dockerfile and build arguments
  - `build_args` object, required: Build arguments to pass to `docker build --build-arg KEY=VALUE`
  - `dockerfile` string, required: The generated Dockerfile content
  - `preset` string, required: The preset slug used for generation

## Other responses

- `401`: Unauthorized
- `404`: Preset not found
- `500`: Internal server error

## Changes

- **2026-04-25** `774be20905f2`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/gotempsh/apis/temps/changes/presets/:slug/dockerfile/post.md)

---

[API](https://skmtc.dev/gotempsh/apis/temps.md) - [All operations](https://skmtc.dev/gotempsh/apis/temps/llms.txt) - [OpenAPI document](https://skmtc.dev/gotempsh/apis/temps/revisions/3b040526eb43?raw)
