{"id":16340059,"url":"https://github.com/nathanhowell/cargo-plan","last_synced_at":"2025-07-08T18:07:11.082Z","repository":{"id":37029477,"uuid":"311453260","full_name":"NathanHowell/cargo-plan","owner":"NathanHowell","description":"Docker Friendly Build Plans for Cargo","archived":false,"fork":false,"pushed_at":"2023-05-22T13:56:48.000Z","size":354,"stargazers_count":1,"open_issues_count":6,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T12:12:52.793Z","etag":null,"topics":["cargo-subcommand","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NathanHowell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-09T20:12:01.000Z","updated_at":"2022-01-10T17:22:01.000Z","dependencies_parsed_at":"2023-02-10T09:15:42.458Z","dependency_job_id":null,"html_url":"https://github.com/NathanHowell/cargo-plan","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NathanHowell/cargo-plan","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanHowell%2Fcargo-plan","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanHowell%2Fcargo-plan/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanHowell%2Fcargo-plan/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanHowell%2Fcargo-plan/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NathanHowell","download_url":"https://codeload.github.com/NathanHowell/cargo-plan/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NathanHowell%2Fcargo-plan/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264321015,"owners_count":23590565,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cargo-subcommand","rust"],"created_at":"2024-10-10T23:55:50.621Z","updated_at":"2025-07-08T18:07:11.059Z","avatar_url":"https://github.com/NathanHowell.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Docker Friendly Build Plans for Cargo\n\nCargo has long been missing a [build --dependencies-only](https://github.com/rust-lang/cargo/issues/2644)\nfeature, prompting various hacks and workarounds especially for Docker builds.\n\nThis package aims to use existing tools and file formats whenever possible:\n* `cargo metadata` is used to generate a minimal buildable project mirroring the current one\n* The output is a standard Tar archive containing stubs in place of source files, trivial to copy and inspect\n* Post-build cleaning of compiled stubs is completed with `cargo clean`\n* `Dockerfile` generation uses a template that is updated by Dependabot\n\n## Usage\n\nTo inspect this locally run this script:\n```shell script\n#!/usr/bin/env bash\ncd /path/to/project\ncargo plan create\nmkdir /tmp/example\ncp cargo-plan.tar /tmp/example/\npushd /tmp/example\ncargo plan build\n```\n\n## Example Dockerfile\n\nRunning `cargo plan generate-dockefile` produces a `Dockerfile` specialized for the current project.\nIf there are multiple binary targets it picks an arbitrary target as it's entrypoint.\n\n```dockerfile\nFROM rust:1-slim-buster@sha256:b0b99a29bfa1a80a95051b7608ac44a0e4cbe20bdba466e43fd52492fb334eaf AS base\nWORKDIR app\nRUN cargo install --git https://github.com/NathanHowell/cargo-plan --rev e3f594ae62b2b4c6861458e41bb7079345b3efa7\n\nFROM base AS planner\nCOPY . .\nRUN cargo plan create -- --all-features --locked\n\nFROM base AS builder\nCOPY --from=planner /app/cargo-plan.tar cargo-plan.tar\nRUN cargo plan build -- --release --frozen\nCOPY . .\nRUN cargo build --release --bins --frozen\n\nFROM debian:buster-slim@sha256:1be41347adaee8303bf12114b9edf4af0b35a5e1d9756b3ddad59856eaa31ea7\nWORKDIR app\nCOPY --from=builder [\"/app/target/release/cargo-plan\", \"./\"]\nENTRYPOINT [\"/app/cargo-plan\"]\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanhowell%2Fcargo-plan","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnathanhowell%2Fcargo-plan","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnathanhowell%2Fcargo-plan/lists"}