### Example Build Plan Output Source: https://context7.com/zeabur/zbpack/llms.txt This is an example of the output generated when using the `--info` flag, detailing the detected build plan components. ```text ╔══════════════════════════ Build Plan ═════════════════════════╗ ║ provider │ nodejs ║ ║───────────────────────────────────────────────────────────────║ ║ startCmd │ node index.js ║ ║───────────────────────────────────────────────────────────────║ ║ packageManager │ pnpm ║ ║───────────────────────────────────────────────────────────────║ ║ framework │ none ║ ║───────────────────────────────────────────────────────────────║ ║ nodeVersion │ 16 ║ ║───────────────────────────────────────────────────────────────║ ║ installCmd │ pnpm install ║ ╚═══════════════════════════════════════════════════════════════╝ ``` -------------------------------- ### Bun Install Command Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/bun-plain.txt Command to install project dependencies using Bun. This is executed after the initial build setup. ```bash RUN bun install ``` -------------------------------- ### Start Development Server Source: https://github.com/zeabur/zbpack/blob/main/tests/bun-without-lockfile/README.md Launches the local development server for the Elysia application. ```bash bun run dev ``` -------------------------------- ### Install Gunicorn and Dependencies Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-django-static.txt Installs Gunicorn and then installs Python dependencies from requirements.txt, excluding editable installs. ```bash RUN pip install gunicorn RUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/zeabur/zbpack/blob/main/tests/bun-yarn-lockfile/README.md Use this command to install all project dependencies managed by Bun. Ensure Bun is installed globally. ```bash bun install ``` -------------------------------- ### Bun Start Command Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/bun-plain.txt Command to run the application using Bun. This is the primary command for starting the service. ```bash bun run start ``` -------------------------------- ### Install Phoenix dependencies Source: https://github.com/zeabur/zbpack/blob/main/tests/elixir-cases/elixir/README.md Run this command to fetch all required project dependencies. ```bash mix deps.get ``` -------------------------------- ### Application Startup Command Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-django-static.txt Starts the Nginx server and then runs the Gunicorn application server. This is the primary command to launch the application. ```bash _startup() { /usr/sbin/nginx && gunicorn --bind :8000 core.wsgi; }; _startup ``` -------------------------------- ### zbpack.json Project Configuration Source: https://context7.com/zeabur/zbpack/llms.txt Configure project build, install, start commands, output directory, and language-specific settings. Supports Node.js, Python, Go, Rust, PHP, and Dockerfile customization. ```json { "$schema": "https://schema.zeabur.app/zbpack.json", "install_command": "npm ci --legacy-peer-deps", "build_command": "npm run build:prod", "start_command": "node dist/server.js", "output_dir": "dist", "plan_type": "nodejs", "app_dir": "apps/web", "node": { "framework": "next.js" }, "python": { "entry": "app/main.py", "version": "3.11", "package_manager": "poetry" }, "go": { "entry": "./cmd/api", "cgo": true }, "rust": { "entry": "my-binary", "assets": ["static", "templates"] }, "php": { "version": "8.2", "optimize": true }, "dockerfile": { "name": "custom", "path": "/docker/Dockerfile.prod" }, "streamlit": { "entry": "dashboard.py" } } ``` -------------------------------- ### Bun Installation Command Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/bun-plain.txt Command to install the latest version of Bun globally. This is used during the build process. ```bash RUN npm install -g bun@latest ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-fastapi.txt Installs Python dependencies from requirements.txt. It first removes any editable installs to ensure a clean installation. ```shell RUN pip install -r requirements.txt ``` ```shell RUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin ``` -------------------------------- ### Install Python Dependencies Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-django-static.txt Installs Python dependencies from requirements.txt. Ensure all necessary build tools are installed beforehand. ```bash RUN pip install -r requirements.txt ``` -------------------------------- ### Install Python Dependencies (Excluding Editable Installs) Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-streamlit.txt Installs Python packages from requirements.txt, excluding any packages installed in editable mode (-e). This is useful for ensuring a clean production environment. ```shell RUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin ``` -------------------------------- ### Start Streamlit Application Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-streamlit.txt Starts a Streamlit application, exposing it on port 8080 and binding to all network interfaces (0.0.0.0). This is the command used to run the Streamlit server. ```shell _startup() { streamlit run streamlit_app.py --server.port=8080 --server.address=0.0.0.0; }; _startup ``` -------------------------------- ### Start FastAPI Application Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-fastapi.txt Starts a FastAPI application using uvicorn. This command is typically used for running web applications in production environments. ```shell _startup() { uvicorn main:app --host 0.0.0.0 --port 8080; }; _startup ``` -------------------------------- ### Start Phoenix server Source: https://github.com/zeabur/zbpack/blob/main/tests/elixir-cases/elixir/README.md Commands to launch the Phoenix endpoint, either as a standalone process or within an interactive shell. ```bash mix phx.server ``` ```bash iex -S mix phx.server ``` -------------------------------- ### Conventional Commit Message Example Source: https://github.com/zeabur/zbpack/blob/main/CONTRIBUTING.md Follow this format for commit messages to ensure clarity and adherence to Conventional Commits standards. ```plain feat(planner/rust): Speed up the compilation This commit speeds up the compilation by using `cargo-chef`. It caches the Docker layer and can speed up the compilation by 100%! ``` -------------------------------- ### Add Friends dependency to mix.exs Source: https://github.com/zeabur/zbpack/blob/main/tests/elixir-cases/elixir_ecto/README.md Include this snippet in the dependencies list of your mix.exs file to install the package. ```elixir def deps do [ {:friends, "~> 0.1.0"} ] end ``` -------------------------------- ### Environment Variable Overrides for zbpack Source: https://context7.com/zeabur/zbpack/llms.txt Override zbpack configuration settings using ZBPACK_* environment variables. Supports overriding plan type, build commands, start commands, output directories, and Dockerfile/Nix ignores. Also allows passing variables to Docker builds. ```bash # Override any configuration via ZBPACK_* environment variables export ZBPACK_PLAN_TYPE=nodejs export ZBPACK_BUILD_COMMAND="npm run build" export ZBPACK_START_COMMAND="node server.js" export ZBPACK_OUTPUT_DIR=dist export ZBPACK_IGNORE_DOCKERFILE=true export ZBPACK_IGNORE_NIX=true # Special version overrides export ZOLA_VERSION=0.18.0 # Pass variables to Docker build export ZBPACK_VAR_API_KEY=secret export ZBPACK_VAR_DATABASE_URL=postgres://... ``` -------------------------------- ### Initialize Elysia Project Source: https://github.com/zeabur/zbpack/blob/main/tests/bun-without-lockfile/README.md Creates a new Elysia project template in the specified directory. ```bash bun create elysia ./elysia-example ``` -------------------------------- ### Configure Static Site Output and Routing Source: https://context7.com/zeabur/zbpack/llms.txt Demonstrates how to define SPA routing and serverless function configurations for static site deployments. ```go package main import ( "encoding/json" "os" "github.com/zeabur/zbpack/pkg/types" ) func main() { // Configure SPA routing (all routes serve index.html) config := types.ZeaburOutputConfig{ Routes: []types.ZeaburOutputConfigRoute{ { Src: ".*", Dest: "/index.html", }, }, } // Write config to .zeabur/output/config.json configBytes, _ := json.MarshalIndent(config, "", " ") os.MkdirAll(".zeabur/output", 0755) os.WriteFile(".zeabur/output/config.json", configBytes, 0644) // Configure serverless function funcConfig := types.ZeaburOutputFunctionConfig{ Runtime: "node20", Entry: "index.handler", } // Write function config funcPath := ".zeabur/output/functions/api" os.MkdirAll(funcPath, 0755) funcConfig.WriteTo(funcPath) // Creates .zb-config.json } ``` -------------------------------- ### Create Planner with plan.NewPlanner Source: https://context7.com/zeabur/zbpack/llms.txt Instantiates a new planner using `plan.NewPlanner` to analyze source code for project type and build metadata. It utilizes a filesystem abstraction and project configuration, supporting custom identifiers. ```go package main import ( "fmt" "github.com/spf13/afero" "github.com/zeabur/zbpack/pkg/plan" "github.com/zeabur/zbpack/pkg/zeaburpack" ) func main() { // Create filesystem abstraction for project projectPath := "/path/to/project" src := afero.NewBasePathFs(afero.NewOsFs(), projectPath) // Load project configuration from zbpack.json submoduleName := "api" config := plan.NewProjectConfigurationFromFs(src, submoduleName) // Create planner with supported identifiers planner := plan.NewPlanner( &plan.NewPlannerOptions{ Source: src, Config: config, SubmoduleName: submoduleName, }, zeaburpack.SupportedIdentifiers(config).**, ) // Execute planning planType, planMeta := planner.Plan() fmt.Printf("Detected: %s\n", planType) for key, value := range planMeta { fmt.Printf(" %s: %s\n", key, value) } } ``` -------------------------------- ### Analyze Project Build Plan with zeaburpack.Plan Source: https://context7.com/zeabur/zbpack/llms.txt Use `zeaburpack.Plan` to analyze a project's build plan and metadata from local directories, GitHub repositories, or S3 buckets. Requires appropriate configuration for different sources. Prints the plan and metadata to standard output. ```go package main import ( "fmt" "os" "github.com/zeabur/zbpack/pkg/zeaburpack" "github.com/zeabur/zbpack/pkg/plan" ) func main() { path := "/path/to/project" submodule := "web" // Plan from local directory planType, planMeta := zeaburpack.Plan(zeaburpack.PlanOptions{ Path: &path, SubmoduleName: &submodule, }) fmt.Printf("Plan Type: %s\n", planType) fmt.Printf("Framework: %s\n", planMeta["framework"]) fmt.Printf("Node Version: %s\n", planMeta["nodeVersion"]) fmt.Printf("Start Command: %s\n", planMeta["startCmd"]) // Plan from GitHub repository (requires GITHUB_ACCESS_TOKEN for private repos) githubPath := "https://github.com/zeabur/zbpack" token := os.Getenv("GITHUB_ACCESS_TOKEN") planType, planMeta = zeaburpack.Plan(zeaburpack.PlanOptions{ Path: &githubPath, AccessToken: &token, }) // Plan from S3 bucket s3Path := "s3://bucket-name/path/to/project" planType, planMeta = zeaburpack.Plan(zeaburpack.PlanOptions{ Path: &s3Path, AWSConfig: &plan.AWSConfig{ Region: "us-east-1", AccessKeyID: "AKIAIOSFODNN7EXAMPLE", SecretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY", }, }) // Print formatted plan zeaburpack.PrintPlanAndMeta(planType, planMeta, os.Stdout) } ``` -------------------------------- ### Define Supported Plan Types and Frameworks Source: https://context7.com/zeabur/zbpack/llms.txt Lists the supported languages, Node.js/Python frameworks, and package managers available for automatic detection. ```go package main import "github.com/zeabur/zbpack/pkg/types" // Plan Types (languages/runtimes) var planTypes = []types.PlanType{ types.PlanTypeNodejs, // Node.js projects types.PlanTypeGo, // Go projects types.PlanTypePython, // Python projects types.PlanTypeRuby, // Ruby projects types.PlanTypeDocker, // Custom Dockerfile types.PlanTypePHP, // PHP projects types.PlanTypeJava, // Java projects types.PlanTypeDeno, // Deno projects types.PlanTypeRust, // Rust projects types.PlanTypeDotnet, // .NET projects types.PlanTypeElixir, // Elixir projects types.PlanTypeGleam, // Gleam projects types.PlanTypeBun, // Bun projects types.PlanTypeStatic, // Static files types.PlanTypeSwift, // Swift projects types.PlanTypeDart, // Dart/Flutter projects types.PlanTypeNix, // Nix-based projects } // Node.js frameworks var nodeFrameworks = []types.NodeProjectFramework{ types.NodeProjectFrameworkNextJs, // Next.js types.NodeProjectFrameworkNuxtJs, // Nuxt.js types.NodeProjectFrameworkRemix, // Remix types.NodeProjectFrameworkVite, // Vite types.NodeProjectFrameworkAstro, // Astro types.NodeProjectFrameworkSvelte, // SvelteKit types.NodeProjectFrameworkAngular, // Angular types.NodeProjectFrameworkNestJs, // NestJS types.NodeProjectFrameworkDocusaurus, // Docusaurus types.NodeProjectFrameworkVitepress, // VitePress types.NodeProjectFrameworkHono, // Hono // ... and many more } // Python frameworks var pythonFrameworks = []types.PythonFramework{ types.PythonFrameworkDjango, // Django types.PythonFrameworkFlask, // Flask types.PythonFrameworkFastapi, // FastAPI types.PythonFrameworkStreamlit, // Streamlit types.PythonFrameworkSanic, // Sanic types.PythonFrameworkTornado, // Tornado types.PythonFrameworkReflex, // Reflex } // Package managers var nodePackageManagers = []types.NodePackageManager{ types.NodePackageManagerNpm, // npm types.NodePackageManagerYarn, // Yarn types.NodePackageManagerPnpm, // pnpm types.NodePackageManagerBun, // Bun } var pythonPackageManagers = []types.PythonPackageManager{ types.PythonPackageManagerPip, // pip types.PythonPackageManagerPoetry, // Poetry types.PythonPackageManagerPipenv, // Pipenv types.PythonPackageManagerPdm, // PDM types.PythonPackageManagerRye, // Rye types.PythonPackageManagerUv, // uv } ``` -------------------------------- ### Show Build Plan Only Source: https://context7.com/zeabur/zbpack/llms.txt Analyzes the project directory and displays the build plan without creating a Docker image. Use `--info` or `-i`. ```bash ./zbpack --info /path/to/project ``` ```bash ./zbpack -i /path/to/project ``` -------------------------------- ### Show Build Plan Only Source: https://github.com/zeabur/zbpack/blob/main/README.md Use the -i or --info flag with the zbpack CLI to display only the build plan metadata and information for building an image. ```bash ./zbpack --info corepack-project ``` -------------------------------- ### Run Project with Bun Source: https://github.com/zeabur/zbpack/blob/main/tests/bun-yarn-lockfile/README.md Execute your TypeScript or JavaScript entry point using the Bun runtime. This command is useful for development and testing. ```bash bun run index.ts ``` -------------------------------- ### Build zbpack Binary Source: https://github.com/zeabur/zbpack/blob/main/README.md Build the zbpack binary by running the go build command. This prepares the command-line interface for use. ```bash go build -o zbpack ./cmd/zbpack/main.go ``` -------------------------------- ### Programmatic Project Build with zeaburpack.Build Source: https://context7.com/zeabur/zbpack/llms.txt Uses the zeaburpack library to programmatically build projects. Configure build options like path, submodule, output image, environment variables, and callbacks. Ensure buildctl and buildkitd are running. ```go package main import ( "log" "os" "github.com/zeabur/zbpack/pkg/zeaburpack" ) func main() { path := "/path/to/project" submodule := "api" resultImage := "my-app:latest" interactive := true userVars := map[string]string{ "API_KEY": "secret-key", "NODE_ENV": "production", } err := zeaburpack.Build(&zeaburpack.BuildOptions{ // Path to project directory (required) Path: &path, // Submodule name for monorepos (optional) SubmoduleName: &submodule, // Output image name (optional, defaults to directory name) ResultImage: &resultImage, // Enable interactive mode with colored output Interactive: &interactive, // Environment variables to inject into build UserVars: &userVars, // Log writer (defaults to os.Stderr) LogWriter: os.Stdout, // Callback when plan is determined HandlePlanDetermined: func(t types.PlanType, m types.PlanMeta) { log.Printf("Detected: %s with framework %s", t, m["framework"]) }, // Push image to registry after build PushImage: false, // Proxy registry for base images ProxyRegistry: nil, // BuildKit cache settings CacheFrom: nil, CacheTo: nil, }) if err != nil { log.Fatalf("Build failed: %v", err) } // On success, run with: docker run -p 8080:8080 -e PORT=8080 -it my-app:latest } ``` -------------------------------- ### Run zbpack CLI Source: https://github.com/zeabur/zbpack/blob/main/README.md Execute the zbpack binary to analyze and build a project. The output includes a build plan and build log. ```bash ./zbpack [the directory to analyze and build] ``` -------------------------------- ### Display Help Information Source: https://github.com/zeabur/zbpack/blob/main/README.md Access usage information for the zbpack CLI by using the -h or --help flags. ```bash ./zbpack -h ``` -------------------------------- ### Build Project Directory into Docker Image Source: https://context7.com/zeabur/zbpack/llms.txt Compiles the zbpack CLI and then uses it to build a Docker image from the specified project directory. Requires buildctl and buildkitd to be running. ```bash go build -o zbpack ./cmd/zbpack/main.go ./zbpack /path/to/project ``` -------------------------------- ### Zbpack Configuration Metadata Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-django-static-whitenoise.txt Defines the build environment, dependencies, and startup command for a Django application. ```yaml apt-deps: "build-essential pkg-config clang" build: "RUN pip install -r requirements.txt\nRUN python manage.py collectstatic --noinput" framework: "django" install: "RUN pip install gunicorn\nRUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin" packageManager: "pip" pythonVersion: "3.13" start: "_startup() { gunicorn --bind :8080 core.wsgi; }; _startup" static-flag: "1" static-host-dir: "" static-url-path: "" ``` -------------------------------- ### Custom Packer Implementation in Go Source: https://context7.com/zeabur/zbpack/llms.txt Implement custom packers to generate Dockerfiles for custom project types. The `GenerateDockerfile` method uses a template to construct the Dockerfile based on provided metadata. ```go package custom import ( "text/template" "bytes" "github.com/spf13/afero" "github.com/zeabur/zbpack/pkg/packer" "github.com/zeabur/zbpack/pkg/plan" "github.com/zeabur/zbpack/pkg/types" ) type customPacker struct { *customIdentify } // NewPacker returns a new custom packer func NewPacker() packer.Packer { return &customPacker{ customIdentify: &customIdentify{}, } } // GenerateDockerfile generates a Dockerfile for this project type func (p *customPacker) GenerateDockerfile(meta types.PlanMeta) (string, error) { dockerfileTemplate := `FROM ubuntu:22.04 WORKDIR /app ENV PORT=8080 # Install dependencies RUN apt-get update && apt-get install -y \ curl \ && rm -rf /var/lib/apt/lists/* COPY . . # Install project dependencies RUN {{ .InstallCmd }} # Build the project {{ if .BuildCmd }}RUN {{ .BuildCmd }}{{ end }} EXPOSE 8080 CMD {{ .StartCmd }} ` tmpl, err := template.New("dockerfile").Parse(dockerfileTemplate) if err != nil { return "", err } data := struct { InstallCmd string BuildCmd string StartCmd string }{ InstallCmd: meta["installCmd"], BuildCmd: meta["buildCmd"], StartCmd: meta["startCmd"], } var buf bytes.Buffer if err := tmpl.Execute(&buf, data); err != nil { return "", err } return buf.String(), nil } var _ packer.Packer = (*customPacker)(nil) ``` -------------------------------- ### Bun Build Configuration Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/bun-bagel.txt Specifies the use of Bun as the package manager and its version. This configuration is for a project using the 'bagel' framework. ```yaml PlanType: bun Meta: appDir: "" buildCmd: "" bun: "true" bunVersion: "latest" framework: "bagel" initCmd: "RUN npm install -g bun@latest" installCmd: "RUN bun install" nodeVersion: "22" packageManager: "bun" startCmd: "bun run start" ``` -------------------------------- ### Zbpack Configuration for Django Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-django.txt Defines the build environment, package management, and startup process for a Django application. ```yaml PlanType: python Meta: apt-deps: "build-essential pkg-config clang" build: "RUN pip install -r requirements.txt" framework: "django" install: "RUN pip install gunicorn\nRUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin" packageManager: "pip" pythonVersion: "3.13" start: "_startup() { gunicorn --bind :8080 mysite.wsgi; }; _startup" ``` -------------------------------- ### Zbpack Python Configuration Metadata Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-zba651.txt Defines the build environment, dependencies, and startup command for a Python project. ```yaml PlanType: python Meta: apt-deps: "build-essential pkg-config clang" build: "RUN pip install -r requirements.txt" install: "RUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin" packageManager: "pip" pythonVersion: "3.13" start: "_startup() { python main.py; }; _startup" ``` -------------------------------- ### Generate and Inject into Dockerfile with zeaburpack Source: https://context7.com/zeabur/zbpack/llms.txt Generates a Dockerfile based on a determined plan type and metadata. It can also inject user-defined environment variables and a proxy registry into the generated Dockerfile. ```go package main import ( "fmt" "log" "github.com/zeabur/zbpack/pkg/zeaburpack" "github.com/zeabur/zbpack/pkg/types" ) func main() { // Generate Dockerfile from plan dockerfile, err := zeaburpack.GenerateDockerfile(&zeaburpack.GenerateDockerfileOptions{ PlanType: types.PlanTypeNodejs, PlanMeta: types.PlanMeta{ "nodeVersion": "20", "packageManager": "pnpm", "framework": "next.js", "installCmd": "pnpm install", "buildCmd": "pnpm build", "startCmd": "pnpm start", "outputDir": "", // empty for server-side apps }, }) if err != nil { log.Fatalf("Failed to generate Dockerfile: %v", err) } fmt.Println(dockerfile) // Inject environment variables and registry into Dockerfile userVars := map[string]string{ "NODE_ENV": "production", "API_URL": "https://api.example.com", } proxyRegistry := "docker.io" injectedDockerfile := zeaburpack.InjectDockerfile(dockerfile, &proxyRegistry, userVars) fmt.Println(injectedDockerfile) } ``` -------------------------------- ### Custom Identifier Implementation in Go Source: https://context7.com/zeabur/zbpack/llms.txt Implement custom language or framework identifiers by implementing the `plan.Identifier` interface. The `Match` method checks for project markers like `custom.config.json` or `.customrc`. ```go package custom import ( "github.com/spf13/afero" "github.com/zeabur/zbpack/internal/utils" "github.com/zeabur/zbpack/pkg/plan" "github.com/zeabur/zbpack/pkg/types" ) type customIdentify struct{} // NewIdentifier returns a new custom identifier func NewIdentifier() plan.Identifier { return &customIdentify{} } // PlanType returns the plan type this identifier handles func (i *customIdentify) PlanType() types.PlanType { return types.PlanType("custom") } // Match returns true if this identifier matches the project func (i *customIdentify) Match(fs afero.Fs) bool { // Check for custom framework markers return utils.HasFile(fs, "custom.config.json") || utils.HasFile(fs, ".customrc") } // PlanMeta returns the build metadata for this project func (i *customIdentify) PlanMeta(options plan.NewPlannerOptions) types.PlanMeta { src := options.Source config := options.Config // Read custom configuration meta := types.PlanMeta{ "framework": "custom-framework", } // Check for user overrides if installCmd, err := plan.Cast( config.Get(plan.ConfigInstallCommand), cast.ToStringE, ).Take(); err == nil { meta["installCmd"] = installCmd } else { meta["installCmd"] = "custom install" } if buildCmd, err := plan.Cast( config.Get(plan.ConfigBuildCommand), cast.ToStringE, ).Take(); err == nil { meta["buildCmd"] = buildCmd } else { meta["buildCmd"] = "custom build" } meta["startCmd"] = "custom start" return meta } var _ plan.Identifier = (*customIdentify)(nil) ``` -------------------------------- ### Zbpack Python Configuration Metadata Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-flask-mysql.txt Defines the environment dependencies, build commands, and startup sequence for a Flask application. ```yaml PlanType: python Meta: apt-deps: "build-essential pkg-config clang" build: "RUN pip install -r requirements.txt" framework: "flask" install: "RUN pip install gunicorn\nRUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin" packageManager: "pip" pythonVersion: "3.13" start: "_startup() { gunicorn --bind :8080 app:app; }; _startup" ``` -------------------------------- ### Output Generated Dockerfile Source: https://context7.com/zeabur/zbpack/llms.txt Generates and outputs the Dockerfile for the project without building the image. Use `--dockerfile` or `-d`. ```bash ./zbpack --dockerfile /path/to/project ``` ```bash ./zbpack -d /path/to/project ``` -------------------------------- ### Zbpack Python Configuration Metadata Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-flask-static.txt Defines the environment dependencies, build commands, and startup sequence for a Python Flask application. ```yaml PlanType: python Meta: apt-deps: "build-essential pkg-config clang" build: "RUN pip install -r requirements.txt" framework: "flask" install: "RUN pip install gunicorn\nRUN sed '/-e/d' requirements.txt | pip install -r /dev/stdin" packageManager: "pip" pythonVersion: "3.13" start: "_startup() { gunicorn --bind :8080 main:app; }; _startup" ``` -------------------------------- ### Collect Static Files Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-django-static.txt Collects static files for Django projects. This command should be run during the build process. ```bash RUN python manage.py collectstatic --noinput ``` -------------------------------- ### Specify Submodule for Monorepos Source: https://context7.com/zeabur/zbpack/llms.txt When working with monorepos, specify the submodule or service name to build using the `--submodule` flag. ```bash ./zbpack --submodule api /path/to/project ``` -------------------------------- ### Pass Environment Variables to Build Source: https://context7.com/zeabur/zbpack/llms.txt Inject environment variables into the build process by prefixing them to the zbpack command. These variables can be accessed during the build. ```bash ZBPACK_VAR_API_KEY=secret ./zbpack /path/to/project ``` -------------------------------- ### Dockerfile for Sanic API Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/python-sanic.txt Defines the environment, dependencies, and execution entrypoint for a Sanic-based Python application. ```dockerfile ARG PYTHON_VERSION=3.8.5 ARG PYTHON_PACKAGE=sanic_template ARG WORKDIR=/usr/src/app FROM python:${PYTHON_VERSION} ARG PYTHON_PACKAGE ARG WORKDIR # Meta information LABEL version="0.0.1" LABEL description="Container with Sanic Template API service" # Internal params ENV PYTHONDONTWRITEBYTECODE 1 ENV PYTHONUNBUFFERED 1 ENV PYTHON_PACKAGE ${PYTHON_PACKAGE} # Adding sanic user and group RUN set -o errexit -o nounset \ && echo "Adding sanic user and group" \ && groupadd --system --gid 1000 sanic \ && useradd --system --gid sanic --uid 1000 --shell /bin/bash --no-create-home sanic \ && mkdir --parents ${WORKDIR} && chown -R sanic:sanic ${WORKDIR} USER sanic # Preparing of environment WORKDIR ${WORKDIR} # Add a launcher COPY --chown=sanic:sanic ./entrypoint.sh ./ RUN chmod +x ./entrypoint.sh # Installation of dependencies COPY --chown=sanic:sanic ./requirements/development.txt ./requirements.txt # Use root privilegies to install packages USER root RUN pip install --no-cache-dir -r ./requirements.txt USER sanic # Add a source code COPY --chown=sanic:sanic ./migrations ./migrations COPY --chown=sanic:sanic ./alembic.ini ./alembic.ini COPY --chown=sanic:sanic ./manage.py ./manage.py COPY --chown=sanic:sanic ./${PYTHON_PACKAGE} ./${PYTHON_PACKAGE} # Removing of unused parts (use root privilegies) USER root RUN rm -rf ./requirements.txt USER sanic # Launcher ENTRYPOINT ["./entrypoint.sh"] EXPOSE 8000 ``` -------------------------------- ### Define Dockerfile path in zbpack Source: https://github.com/zeabur/zbpack/blob/main/tests/snapshots/docker-test-path.txt Specifies the Dockerfile path within the project configuration. ```dockerfile FROM alpine CMD "echo dockerfile.path == docker/test.Dockerfile" ``` -------------------------------- ### Ban All Spiders from Site Source: https://github.com/zeabur/zbpack/blob/main/tests/elixir-cases/elixir/priv/static/robots-9e2c81b0855bbff2baa8371bc4a78186.txt To ban all spiders from the entire site, uncomment the User-agent and Disallow directives. ```robots.txt User-agent: * Disallow: / ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.