Guide · App servers
Bring your own Dockerfile
App servers build Python, Go, Rust, Node.js, Bun, Deno, Ruby, PHP, Java, Kotlin, .NET and Elixir projects without any setup. For everything else, add a file named Dockerfile at the top of your project. We build it as it is and run one container from it.
When you need one
If you deploy a project we don't build automatically, the deploy stops with the error dockerfile_required and names the stack it found. That happens for Scala (sbt), Leptos, Erlang (rebar3), Crystal, Nim, Zig, Haskell, Swift and Clojure, among others. You can also add a Dockerfile to any project to control the build yourself; an uploaded Dockerfile always wins.
Ask your AI assistant
AI assistants connected to the zeroconfig MCP server can fetch these same rules and complete example projects with the tool get_dockerfile_guide (no sign-in needed, read-only). Pass a language such as "haskell" to get a Dockerfile, a .dockerignore and a minimal app. The dockerfile_required error tells the assistant which language to ask for. The same data is at https://api.zeroconfig.cloud/v1/containers/dockerfile-guide?language=haskell.
The rules
- Port: we always set
PORT=8080. Listen on0.0.0.0:8080, notlocalhost. HTTPS is handled for you; your server speaks plain HTTP. - Start check: a new version goes live once it accepts connections on port 8080, within 60 seconds of starting. Until then the previous version keeps serving. If it doesn't, the deploy fails and you see the container's last output.
- Build: we build for
linux/amd64(x86_64 servers) with up to 2 GB of memory and 2 CPUs, for at most 15 minutes. Base images are pulled fresh each time, so pin them by version. Build arguments and build secrets aren't passed, and your app settings aren't available while building. Use a multi-stage build and keep compilers to two parallel jobs. - Caching: order your Dockerfile so dependency files are copied and installed before your source code. Don't rely on
RUN --mount=type=cache: that cache can be empty on any build. - Upload: up to 50 MB zipped and 10,000 files. Add a
.dockerignorefor.git,.envfiles and build output. - One image per app: docker-compose files aren't used. Run each service as its own app and use the managed databases instead of database containers.
- Memory and CPU: small app servers have 512 MB and 0.5 vCPU, standard ones 2 GB and 1 vCPU, with no swap. A process that goes over the memory limit is restarted. Up to 512 processes or threads.
- Security: containers run without Linux capabilities and can't gain privileges. Ports below 1024,
sudoand setuid programs won't work. Run as a non-root user. - Files: the container's files reset on every deploy and restart. Keep data in a managed database, or add Persistent storage: a folder (for example
/data) that survives deploys and restarts. - Settings we add:
DATABASE_URL(Postgres),REDIS_URL(Redis),MYSQL_URLplusDB_HOST,DB_PORT,DB_NAME,DB_USERandDB_PASSWORD(MySQL), and every setting you add to the app. - Background workers: make the app a worker and give it a command (or a
worker:line in a Procfile). With your Dockerfile, the command runs throughsh -c, so the image needs/bin/sh. - Logs: write to standard output and standard error; that is what you see in your app's logs.
Verified examples
We built each example on a fresh builder with the same limits as ours (2 GB, 2 CPUs) and ran it with the same settings as a small app server (512 MB, 0.5 vCPU, no capabilities). Each one answered on port 8080 well within the 60-second start check. Your app will be bigger, so treat these numbers as a floor.
| Stack | Language id | First build | Image | Start | Result |
|---|---|---|---|---|---|
| Scala (sbt, Play Framework 3) | scala | 74 s | 147 MB | 6.7 s | Works |
| Leptos (Rust, server-side rendering) | leptos | 206 s | 34 MB | 0.5 s | Works |
| Erlang (rebar3, Cowboy) | erlang | 49 s | 57 MB | 2.3 s | Works |
| Crystal | crystal | 46 s | 14 MB | 0.4 s | Works |
| Nim | nim | 17 s | 4 MB | 0.4 s | Works |
| Zig 0.15 | zig | 29 s | 5 MB | 0.4 s | Works |
| Haskell (cabal, Warp) | haskell | 227 s | 35 MB | 0.4 s | Works |
| Swift (Hummingbird 2) | swift | 237 s | 71 MB | 0.5 s | Works |
| Clojure (deps.edn, http-kit) | clojure | 31 s | 112 MB | 1.8 s | Works |
Example Dockerfiles
Each Dockerfile builds in one stage and runs in a small second stage as a non-root user. The minimal app for each one comes with get_dockerfile_guide.
Scala (sbt, Play Framework 3) (detected from build.sbt)
Set APPLICATION_SECRET (32+ random characters) as an app setting. The example config allows any host name and reads the port from PORT. Full project: get_dockerfile_guide with language: "scala".
# Scala + Play Framework 3 (sbt). Build: sbt stage. Run: the staged start script on a JRE.
FROM sbtscala/scala-sbt:eclipse-temurin-21.0.13.1_2_1.13.1_3.3.9 AS build
WORKDIR /src
# Dependencies first (cached layer): only the build definition.
COPY build.sbt ./
COPY project/build.properties project/plugins.sbt project/
RUN sbt -Dsbt.server.forcestart=false update
COPY . .
# The staged start script is owner-only executable (0744); the app runs as another user.
RUN sbt -Dsbt.server.forcestart=false stage && chmod 0755 target/universal/stage/bin/hello-play
FROM eclipse-temurin:21-jre-noble
RUN useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /src/target/universal/stage /app
# 70% of the container memory for the heap, serial GC (0.5-1 vCPU), exit on OOM so the platform restarts it.
ENV PORT=8080 JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=70 -XX:+UseSerialGC -Xss512k -XX:+ExitOnOutOfMemoryError"
USER 10001
EXPOSE 8080
# No RUNNING_PID file: the app folder is read-only to the app user.
CMD ["/app/bin/hello-play", "-Dplay.server.pidfile.path=/dev/null"]
Leptos (Rust, server-side rendering) (detected from Cargo.toml with [package.metadata.leptos])
Uses a pinned, checksum-verified cargo-leptos release; the image holds the server binary and the site folder. Full project: get_dockerfile_guide with language: "leptos".
# Leptos 0.8 SSR (Axum) with hydration. Build: cargo-leptos (server binary + WASM/JS bundle in target/site).
# Run: the server binary and the site folder on Debian slim.
FROM rust:1.100-bookworm AS build
RUN rustup target add wasm32-unknown-unknown \
&& curl -fsSLo /tmp/cargo-leptos.tar.gz https://github.com/leptos-rs/cargo-leptos/releases/download/v0.3.11/cargo-leptos-x86_64-unknown-linux-gnu.tar.gz \
&& echo "1c9cf0e1e3ffae6c8b58d29281d949dab560cea613b80d361f323f93071df7c8 /tmp/cargo-leptos.tar.gz" | sha256sum -c - \
&& tar -xzf /tmp/cargo-leptos.tar.gz -C /usr/local/bin --strip-components=1 cargo-leptos-x86_64-unknown-linux-gnu/cargo-leptos \
&& rm /tmp/cargo-leptos.tar.gz
WORKDIR /src
COPY . .
# Two parallel jobs keep the compiler inside the 2 GB build memory.
ENV CARGO_BUILD_JOBS=2
RUN cargo leptos build --release
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates && rm -rf /var/lib/apt/lists/* \
&& useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /src/target/release/hello-leptos /app/server
COPY --from=build /src/target/site /app/site
# Leptos reads its address from LEPTOS_SITE_ADDR (the platform's PORT is always 8080).
ENV PORT=8080 LEPTOS_SITE_ADDR=0.0.0.0:8080 LEPTOS_SITE_ROOT=site LEPTOS_OUTPUT_NAME=hello-leptos LEPTOS_ENV=PROD RUST_LOG=info
USER 10001
EXPOSE 8080
CMD ["/app/server"]
Erlang (rebar3, Cowboy) (detected from rebar.config)
An OTP release with the runtime included, on Debian slim. Full project: get_dockerfile_guide with language: "erlang".
# Erlang/OTP 28 + rebar3 + Cowboy. Build: rebar3 as prod release (ERTS included). Run: the release on Debian slim.
FROM erlang:28.5 AS build
WORKDIR /src
# Dependencies first (cached layer).
COPY rebar.config rebar.lock* ./
RUN rebar3 as prod get-deps
COPY . .
RUN rebar3 as prod release && mv _build/prod/rel/hello /out
# Same Debian release as the erlang:28 image so the bundled ERTS finds its libraries.
FROM debian:trixie-slim
RUN apt-get update && apt-get install -y --no-install-recommends libstdc++6 openssl libncurses6 ca-certificates && rm -rf /var/lib/apt/lists/* \
&& useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /out /app
# HOME and the crash dump in /tmp: the app folder is read-only to the app user.
ENV PORT=8080 LANG=C.UTF-8 HOME=/tmp ERL_CRASH_DUMP=/tmp/erl_crash.dump RELX_OUT_FILE_PATH=/tmp
USER 10001
EXPOSE 8080
CMD ["/app/bin/hello", "foreground"]
Crystal (detected from shard.yml)
One static binary on Alpine. Commit shard.lock. Full project: get_dockerfile_guide with language: "crystal".
# Crystal: a static binary built on Alpine (musl), run on a small Alpine image.
FROM crystallang/crystal:1.22.3-alpine AS build
WORKDIR /src
# Dependencies first (cached layer). --production needs a committed shard.lock (`shards install` writes it).
COPY shard.yml shard.lock ./
RUN shards install --production
COPY . .
RUN shards build --production --release --static --no-debug
FROM alpine:3.23
RUN adduser -D -H -u 10001 app
WORKDIR /app
COPY --from=build /src/bin/hello /app/server
ENV PORT=8080
USER 10001
EXPOSE 8080
CMD ["/app/server"]
Nim (detected from *.nimble)
One static binary on Alpine. Full project: get_dockerfile_guide with language: "nim".
# Nim 2.2: a static binary built on Alpine (musl), run on a small Alpine image.
FROM nimlang/nim:2.2.6-alpine-regular AS build
WORKDIR /src
COPY . .
RUN nimble build -y -d:release --opt:speed --passL:-static
FROM alpine:3.23
RUN adduser -D -H -u 10001 app
WORKDIR /app
COPY --from=build /src/hello /app/server
ENV PORT=8080
USER 10001
EXPOSE 8080
CMD ["/app/server"]
Zig 0.15 (detected from build.zig)
Downloads a pinned Zig release (checksum verified) and builds a static binary. Full project: get_dockerfile_guide with language: "zig".
# Zig 0.15.2 (pinned release from ziglang.org, checksum verified): a static musl binary on a small Alpine image.
FROM alpine:3.23 AS build
RUN apk add --no-cache curl xz \
&& curl -fsSLo /tmp/zig.tar.xz https://ziglang.org/download/0.15.2/zig-x86_64-linux-0.15.2.tar.xz \
&& echo "02aa270f183da276e5b5920b1dac44a63f1a49e55050ebde3aecc9eb82f93239 /tmp/zig.tar.xz" | sha256sum -c - \
&& mkdir /opt/zig && tar -xJf /tmp/zig.tar.xz -C /opt/zig --strip-components=1 && rm /tmp/zig.tar.xz
ENV PATH=/opt/zig:$PATH
WORKDIR /src
COPY . .
RUN zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux-musl --prefix /out
FROM alpine:3.23
RUN adduser -D -H -u 10001 app
WORKDIR /app
COPY --from=build /out/bin/hello /app/server
ENV PORT=8080
USER 10001
EXPOSE 8080
CMD ["/app/server"]
Haskell (cabal, Warp) (detected from *.cabal, cabal.project, stack.yaml)
Dependencies are compiled in their own cached layer. Full project: get_dockerfile_guide with language: "haskell".
# Haskell (GHC 9.12, cabal) + Warp. Build: cabal install. Run: the binary on Debian slim.
FROM haskell:9.12-slim-bookworm AS build
WORKDIR /src
RUN cabal update
# Dependencies first (cached layer): only the .cabal file.
COPY hello.cabal ./
RUN cabal build --only-dependencies -j2
COPY . .
RUN cabal install -j2 --installdir=/out --install-method=copy --overwrite-policy=always exe:hello
FROM debian:bookworm-slim
RUN apt-get update && apt-get install -y --no-install-recommends libgmp10 libffi8 ca-certificates && rm -rf /var/lib/apt/lists/* \
&& useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /out/hello /app/server
ENV PORT=8080
USER 10001
EXPOSE 8080
CMD ["/app/server"]
Swift (Hummingbird 2) (detected from Package.swift)
The Swift runtime is linked into the binary, so the runtime image is plain Ubuntu 24.04. Full project: get_dockerfile_guide with language: "swift".
# Swift 6.4 + Hummingbird 2. Build: swift build with the Swift runtime linked in statically. Run: Ubuntu 24.04.
FROM swift:6.4-noble AS build
WORKDIR /src
# Dependencies first (cached layer): Package.swift (and Package.resolved if you have one).
COPY Package.* ./
RUN swift package resolve
COPY . .
RUN swift build -c release --static-swift-stdlib -j 2 \
&& mkdir /out && cp "$(swift build -c release --show-bin-path)/App" /out/server
FROM ubuntu:24.04
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates tzdata && rm -rf /var/lib/apt/lists/* \
&& useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /out/server /app/server
ENV PORT=8080
USER 10001
EXPOSE 8080
CMD ["/app/server"]
Clojure (deps.edn, http-kit) (detected from deps.edn, project.clj)
An ahead-of-time compiled uberjar on a Java 25 runtime. Full project: get_dockerfile_guide with language: "clojure".
# Clojure (tools.deps + tools.build) + http-kit. Build: an AOT-compiled uberjar. Run: it on a JRE.
FROM clojure:temurin-25-tools-deps-1.12.7.1681-trixie-slim AS build
WORKDIR /src
# Dependencies first (cached layer).
COPY deps.edn build.clj ./
RUN clojure -P -A:build
COPY . .
RUN clojure -T:build uber
FROM eclipse-temurin:25-jre-noble
RUN useradd --uid 10001 --no-create-home --shell /usr/sbin/nologin app
WORKDIR /app
COPY --from=build /src/target/app.jar /app/app.jar
ENV PORT=8080 JAVA_TOOL_OPTIONS="-XX:MaxRAMPercentage=70 -XX:+UseSerialGC -Xss512k -XX:+ExitOnOutOfMemoryError"
USER 10001
EXPOSE 8080
CMD ["java", "-jar", "/app/app.jar"]
Run your stack on an app server
Create your account and deploy from your assistant, GitHub or an upload.