Loading...
Loading...
Use when generating a Dockerfile for deploying a project to Zeabur. Use when the user needs help writing a Dockerfile for Node.js, Python, Go, Rust, PHP, Ruby, Java, .NET, or Elixir projects. Use when troubleshooting Dockerfile build failures on Zeabur.
npx skill4agent add zeabur/agent-skills zeabur-dockerfileAlways useto invoke Zeabur CLI. Never usenpx zeabur@latestdirectly or any other installation method. Ifzeaburis not available, install Node.js first.npx
| Language | Files to read |
|---|---|
| Node.js | |
| Python | |
| Go | |
| Rust | |
| PHP | |
| Ruby | |
| Java | |
| .NET | |
| Elixir | |
Dockerfiledocker-compose.ymlvite.config.jswebpack.config.jsnext.config.js.env.exampleENVARGLABEL "language"="<lang>"nodejspythongostaticrubyjavaphprustdotnetelixirswiftbunLABEL "framework"="<framework>"COPY . .WORKDIR /srcEXPOSEzeabur/caddy-staticLABEL "framework"="..."vitecreate-react-appnext.jsremixnuxt.jsuminest.jshexovitepressastrosli.devdocusaurusnitropackhonomedusasvelteflaskdjangofastapispring-bootlaravelthinkphprailsaspnetblazorwasmelysiabaojsIf unsure whether something is a framework or package, do NOT add the framework label.
zeabur/caddy-staticzeabur/caddy-staticFROM node:22-slim AS build
LABEL "language"="nodejs"
LABEL "framework"="vite"
WORKDIR /src
COPY . .
RUN npm install
RUN npm run build
FROM zeabur/caddy-static
COPY /src/dist /usr/share/caddyzeabur/caddy-static/usr/share/caddyCMDENTRYPOINT8080LABEL "language"="nodejs""static"node:22-slim| Lockfile | Package manager | Install command |
|---|---|---|
| npm | |
| yarn | |
| pnpm | |
npmnpm installnpm ci--only=production--omit=dev--frozen-lockfilezeabur/caddy-staticPORT=8080FROM node:22-slim
LABEL "language"="nodejs"
LABEL "framework"="next.js"
WORKDIR /src
COPY . .
RUN npm install
RUN npm run build
EXPOSE 8080
CMD ["npm", "start"]node:22ENV PORT=8080zeabur/caddy-staticcross-env ADAPTER=staticFROM node:22
LABEL "language"="nodejs"
LABEL "framework"="svelte"
ENV PORT=8080
WORKDIR /src
RUN npm install -g pnpm@9
COPY . .
RUN pnpm install
RUN pnpm build
EXPOSE 8080
CMD ["pnpm", "start"]python:3.10main.pyapp = Flask(__name__)main:appFROM python:3.10
LABEL "language"="python"
LABEL "framework"="flask"
WORKDIR /src
COPY . .
RUN pip install -r requirements.txt gunicorn
EXPOSE 8080
CMD ["gunicorn", "--bind", "0.0.0.0:8080", "main:app"]fastapi-clirequirements.txtfastapi runif __name__ == "__main__":.pypython <file>.pyuvicorn main:app --host 0.0.0.0 --port 8080uvicornFROM python:3.10
LABEL "language"="python"
LABEL "framework"="fastapi"
WORKDIR /src
COPY . .
RUN pip install -r requirements.txt
EXPOSE 8080
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"]gunicornpython <file>.pyFROM golang:1.23 AS build
WORKDIR /src
COPY . .
RUN go build -o /app .
FROM debian:bookworm-slim
LABEL "language"="go"
COPY /app /app
EXPOSE 8080
CMD ["/app"]FROM php:8.3-fpm
LABEL "language"="php"
WORKDIR /var/www
ADD https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/
RUN chmod +x /usr/local/bin/install-php-extensions && sync
RUN apt update && apt install -y cron curl gettext git grep libicu-dev nginx pkg-config unzip && rm -rf /var/lib/apt/lists/*
RUN install-php-extensions @composer apcu bcmath gd intl mysqli opcache pcntl pdo_mysql sysvsem zip
RUN cat <<'NGINX' > /etc/nginx/sites-enabled/default
server {
listen 8080;
root /var/www;
index index.php index.html;
charset utf-8;
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
location ~ \.php$ {
try_files $uri =404;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_param PATH_INFO $fastcgi_path_info;
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ /\.(?!well-known).* { deny all; }
error_log /dev/stderr;
access_log /dev/stderr;
}
NGINX
RUN chown -R www-data:www-data /var/www
COPY . /var/www
USER www-data
RUN if [ -f composer.json ]; then composer install --optimize-autoloader --classmap-authoritative --no-dev; fi && if [ -f package.json ]; then npm install; fi
USER root
EXPOSE 8080
CMD ["sh", "-c", "php-fpm -D && nginx -g 'daemon off;'"]composer installRUN php artisan config:cache && php artisan route:cache && php artisan view:cachelanguageframeworknpx zeabur@latest deploy --project-id <project-id> --jsonnpx zeabur@latest deploy --project-id <project-id> --service-id <service-id> --jsonzeabur-deployzeabur-deployment-logsRUNEXPOSEzeabur-port-mismatchCMDzeabur/caddy-static--service-id