# Optimal Dockerfiles (https://depot.dev/docs/container-builds/optimal-dockerfiles/overview)

The following guides provide optimal Dockerfiles that are tailored for Depot container build cache and your preferred programming language. You can use these Dockerfiles as reference implementations or starting points for your own projects.

If you already have a Dockerfile and want to optimize it for your Depot builds, refer to the *Understanding BuildKit Cache Mounts* section in each guide. This section explains:

* How to add cache mounts to your existing `RUN` commands
* Cache mount parameters (`id`, `target`, `sharing`)
* Language-specific cache strategies and optimization techniques

The cache mount integration is the core enhancement that makes builds significantly faster on Depot, and these sections provide everything you need to retrofit your existing Dockerfiles. For more in-depth information on BuildKit cache mounts, please refer to the blog post [How to use cache mounts to speed up Docker builds](https://depot.dev/blog/how-to-use-cache-mount-to-speed-up-docker-builds).

## Guides

### Node.js

* [Node.js Dockerfiles](/docs/container-builds/optimal-dockerfiles/node)

### Python

* [Python Dockerfiles](/docs/container-builds/optimal-dockerfiles/python)

### Java

* [Java Dockerfiles](/docs/container-builds/optimal-dockerfiles/java)

### .NET

* [.NET Dockerfiles](/docs/container-builds/optimal-dockerfiles/dotnet)

### Other Languages

* [Dockerfile for Go](/docs/container-builds/optimal-dockerfiles/go-dockerfile)
* [Dockerfile for PHP using Composer](/docs/container-builds/optimal-dockerfiles/php-composer-dockerfile)
* [Dockerfile for Ruby using Bundler](/docs/container-builds/optimal-dockerfiles/ruby-bundler-dockerfile)
* [Dockerfile for Rust](/docs/container-builds/optimal-dockerfiles/rust-dockerfile)

## For AI Agents

The full site index is at [llms.txt](https://depot.dev/llms.txt). Append `.md` to any documentation, blog, changelog, or customer URL to fetch its markdown source directly.