|
| 1 | +--- |
| 2 | +name: ship |
| 3 | +description: Use when the user asks to deploy the current project with Ship, usually as "$ship deploy this project as <service>". Prepares the project, creates a Dockerfile when needed, runs a dry-run first, then deploys after the plan is valid. |
| 4 | +--- |
| 5 | + |
| 6 | +# Ship |
| 7 | + |
| 8 | +Deploy a local project with the `ship` CLI. |
| 9 | + |
| 10 | +## Workflow |
| 11 | + |
| 12 | +1. Identify the target project directory. |
| 13 | +2. Derive the service name from the user request. If absent, use the current directory name normalized to DNS-safe lowercase. |
| 14 | +3. If the project has no `Dockerfile`, inspect the project and create a minimal suitable one using its existing runtime, lockfile, package manager, build script, and start command. If the runtime cannot be inferred safely, stop and report the missing information. |
| 15 | +4. Run the dry-run first: |
| 16 | + |
| 17 | +```sh |
| 18 | +ship --service <service> --cwd <project-dir> --dry-run --json |
| 19 | +``` |
| 20 | + |
| 21 | +5. Read the JSON plan. Stop and report the exact error if planning fails. |
| 22 | +6. If the plan is valid and the user asked to deploy, run: |
| 23 | + |
| 24 | +```sh |
| 25 | +ship --service <service> --cwd <project-dir> |
| 26 | +``` |
| 27 | + |
| 28 | +7. Verify with the rollout command from the plan, then report the deployed host. |
| 29 | + |
| 30 | +## Rules |
| 31 | + |
| 32 | +- Prefer an existing `Dockerfile`; do not overwrite it unless the user explicitly asks. |
| 33 | +- Keep generated Dockerfiles minimal and conventional. Use detected project commands instead of adding new dependencies. |
| 34 | +- Do not invent domain, namespace, gateway, registry, or cluster values. Let `ship` read `~/.config/ship/config.env`, environment variables, and CLI defaults. |
| 35 | +- Use `--env-file` only when the user names an env file or the project has a clear deployment env file such as `.env.production`. |
| 36 | +- Use `--exposure internet` only when the user explicitly asks for public internet exposure. |
| 37 | +- If you created a `Dockerfile`, mention that in the final report. |
| 38 | +- Keep deployment output concise: service, host, image, namespace, and verification command result. |
0 commit comments