{"id":22139607,"url":"https://github.com/bjarneo/pipe","last_synced_at":"2025-07-17T01:37:07.434Z","repository":{"id":262330023,"uuid":"886911602","full_name":"bjarneo/pipe","owner":"bjarneo","description":"🐋 A simple CLI tool for deploying Docker containers to remote hosts via SSH without the need of a registry.","archived":false,"fork":false,"pushed_at":"2024-11-30T10:01:45.000Z","size":11455,"stargazers_count":17,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-01T11:59:11.865Z","etag":null,"topics":["container","deploy","deployment","docker","pipe","ssh"],"latest_commit_sha":null,"homepage":"","language":"Go","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/bjarneo.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-11T20:41:06.000Z","updated_at":"2025-05-03T08:16:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"aeda93f5-61c5-40d5-bcf1-b82234b814fc","html_url":"https://github.com/bjarneo/pipe","commit_stats":null,"previous_names":["bjarneo/copepod"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/bjarneo/pipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fpipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fpipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fpipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fpipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bjarneo","download_url":"https://codeload.github.com/bjarneo/pipe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bjarneo%2Fpipe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265558804,"owners_count":23787981,"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":["container","deploy","deployment","docker","pipe","ssh"],"created_at":"2024-12-01T20:16:00.325Z","updated_at":"2025-07-17T01:37:07.414Z","avatar_url":"https://github.com/bjarneo.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Pipe: A small and easy Docker deployment tool\nA simple yet powerful Go-based CLI tool for automating Docker container deployments to remote servers without the use of a registry. This tool handles the entire deployment process including building Docker images, transferring them to remote hosts, and managing container lifecycle.\n\n## Why the name pipe?\nBecause the docker image is piped through ssh and loaded to the docker instance\n\nhttps://github.com/user-attachments/assets/68111156-4445-43c1-9d63-071b2680abc3\n\n## Prerequisites\n\n- Docker installed locally and on the remote host\n- SSH access to the remote host\n- SSH key-based authentication\n- Go 1.21 or higher (due to usage of slices.Reverse)\n\n## Installation\n\n### Quick Install (curl)\n\nYou can quickly install pipe using curl:\n\n```bash\ncurl -fsSL https://raw.githubusercontent.com/bjarneo/pipe/refs/heads/main/install.sh | sh\n```\n\n### Pre-built Binaries\n\nDownload the latest pre-built binary from the [releases page](https://github.com/bjarneo/pipe/releases).\n\nAvailable binaries:\n\n- Linux (AMD64): `pipe-linux-amd64`\n- Linux (ARM64): `pipe-linux-arm64`\n- macOS (Intel): `pipe-darwin-amd64`\n- macOS (Apple Silicon): `pipe-darwin-arm64`\n\nAfter downloading:\n\n1. Verify the checksum (SHA-256):\n\n```bash\nsha256sum -c pipe-\u003cos\u003e-\u003carch\u003e.sha256\n```\n\n2. Make the binary executable:\n\n```bash\nchmod +x pipe-\u003cos\u003e-\u003carch\u003e\n```\n\n3. Optionally, move to your PATH:\n\n```bash\n# Example for Linux/macOS\nsudo mv pipe-\u003cos\u003e-\u003carch\u003e /usr/local/bin/pipe\n```\n\n### Building from Source\n\nAlternatively, you can build from source:\n\nRequirements:\n\n- Go 1.21 or higher\n\n```bash\ngit clone \u003crepository-url\u003e\ncd pipe\ngo build -o pipe\n```\n\n## Usage\n\n```bash\n./pipe [options]\n```\n\n### Command Line Options\n\n| Option           | Environment Variable        | Default          | Description                    |\n|-----------------|----------------------------|------------------|----------------------------------|\n| --host          | HOST                      |                  | Remote host to deploy to          |\n| --user          | HOST_USER                 |                  | SSH user for remote host          |\n| --image         | DOCKER_IMAGE_NAME         | pipe_app      | Docker image name                 |\n| --tag           | DOCKER_IMAGE_TAG          | latest           | Docker image tag                  |\n| --platform      | HOST_PLATFORM             | linux/amd64      | Docker platform                   |\n| --ssh-key       | SSH_KEY_PATH              |                  | Path to SSH key                   |\n| --container-name| DOCKER_CONTAINER_NAME     | pipe_app      | Name for the container            |\n| --container-port| DOCKER_CONTAINER_PORT     | 3000             | Container port                    |\n| --host-port     | HOST_PORT                 | 3000             | Host port                         |\n| --env-file      | DOCKER_CONTAINER_ENV_FILE |                  | Environment file                  |\n| --dockerfile    |                           | Dockerfile       | Dockerfile path                   |\n| --build-arg     | BUILD_ARGS                |                  | Build arguments (KEY=VALUE)       |\n| --rollback      |                           |                  | Rollback to the previous instance |\n| --network       | DOCKER_NETWORK            |                  | Docker network to connect to     |\n| --volume        |                           |                  | Volume mount (host:container)    |\n| --cpus          | DOCKER_CPUS               |                  | Number of CPUs                   |\n| --memory        | DOCKER_MEMORY             |                  | Memory limit                     |\n\n### Example Commands\n\nBasic deployment:\n\n```bash\n./pipe --host example.com --user deploy\n```\n\nDeployment with custom ports:\n\n```bash\n./pipe --host example.com --user deploy --container-name myapp --container-port 8080 --host-port 80\n```\n\nUsing environment file:\n\n```bash\n./pipe --env-file .env.production\n```\n\nRollback:\n\n```bash\n# For rollback to work you need to deploy using different tags, and not override the same tag each deploy\n./codepod --host example.com --user deploy --container-name myapp --container-port 8080 --host-port 80 --rollback\n```\n\nUsing build arguments:\n\n```bash\n# Single build argument\n./pipe --host example.com --user deploy --build-arg VERSION=1.0.0\n\n# Multiple build arguments\n./pipe --host example.com --user deploy --build-arg VERSION=1.0.0 --build-arg ENV=prod\n\n# Using environment variable\n# Using git commit hash\n./pipe --host example.com --user deploy --build-arg GIT_HASH=$(git rev-parse HEAD)\n```\n\nAdvanced deployment with resource limits and volumes:\n\n```bash\n./pipe --host example.com --user deploy \\\n  --network my-network \\\n  --volume /host/data:/container/data \\\n  --volume /host/config:/container/config \\\n  --cpus 2 \\\n  --memory 1g\n```\n\n## Directory Structure\n\nYour project directory should look like this:\n\n```\n.\n├── Dockerfile            # Required: Docker build instructions\n├── your_code            # Your code\n└── .env.production      # Optional: Environment variables\n```\n\n## Example Github workflow\n\nDeployment workflow:\n\n```yml\nname: Deploy Application\n\non:\n  push:\n    tags:\n      - 'v*'\n\njobs:\n  deploy:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout code\n        uses: actions/checkout@v4\n\n      - name: Get version from tag\n        id: get_version\n        run: echo \"VERSION=${GITHUB_REF#refs/tags/}\" \u003e\u003e $GITHUB_OUTPUT\n\n      - name: Deploy to production\n        uses: bjarneo/pipe@main\n        with:\n          host: remote_host.com\n          user: deploy_user\n          ssh_key: ${{ secrets.PRIVATE_SSH_KEY }}\n          image: myapp\n          tag: ${{ steps.get_version.outputs.VERSION }}\n          container_name: myapp_prod\n          container_port: 3000\n          host_port: 80\n          env_file: .env.production\n          build_args: |\n            VERSION=${{ steps.get_version.outputs.VERSION }},\n            NODE_ENV=production,\n            BUILD_TIME=${{ github.event.repository.updated_at }}\n```\n\nRollback workflow:\n\n```yml\nname: Deploy Application\n\non:\n  workflow_dispatch:\n    inputs:\n      environment:\n        description: 'Environment to rollback'\n        required: true\n        type: choice\n        options:\n          - production\n          - staging\n      reason:\n        description: 'Reason for rollback'\n        required: true\n        type: string\n  \njobs:\n  rollback:\n    runs-on: ubuntu-latest\n    environment: ${{ github.event.inputs.environment }}\n    steps:\n      # Example of rolling back if needed\n      # NOTE: You want to have a manual approval step in between to ensure you want to rollback\n      - name: Rollback production\n        uses: bjarneo/pipe@main\n        with:\n          host: remote_host.com\n          user: deploy_user\n          ssh_key: ${{ secrets.PRIVATE_SSH_KEY }}\n          image: myapp\n          container_name: myapp_prod\n          container_port: 3000\n          host_port: 80\n\n          # This has to be set to true for rollback to work\n          rollback: true\n```\n\n## GitHub Action Inputs\n\nWhen using Pipe as a GitHub Action, the following inputs are available:\n\n| Input            | Required | Default        | Description                                     |\n|------------------|----------|----------------|-------------------------------------------------|\n| host             | Yes      |                | Remote host to deploy to                        |\n| user             | Yes      |                | SSH user for remote host                        |\n| ssh_key          | Yes      |                | SSH private key for authentication              |\n| image            | No       | pipe_app    | Docker image name                               |\n| tag              | No       | latest         | Docker image tag                                |\n| platform         | No       | linux/amd64    | Docker platform                                 |\n| container_name   | No       | pipe_app    | Name for the container                          |\n| container_port   | No       | 3000           | Container port                                  |\n| host_port        | No       | 3000           | Host port                                       |\n| env_file         | No       |                | Path to environment file                        |\n| dockerfile       | No       | Dockerfile     | Path to Dockerfile                              |\n| build_args       | No       |                | Build arguments (comma-separated KEY=VALUE pairs)|\n| rollback         | No       | false          | Whether to perform a rollback                   |\n| network          | No       |                | Docker network to connect to                    |\n| volume           | No       |                | Volume mount (host:container)                   |\n| cpus             | No       |                | Number of CPUs                                  |\n| memory           | No       |                | Memory limit                                    |\n\n## Deployment Process\n\n1. Validates configuration and checks prerequisites\n2. Verifies Docker installation and SSH connectivity\n3. Builds Docker image locally with any provided build arguments\n4. Transfers image to remote host\n5. Copies environment file (if specified)\n6. Stops and removes existing container\n7. Starts new container with specified configuration\n8. Verifies container is running properly\n9. Automatically cleans up old releases (keeps only the latest 5 images)\n\nFlow chart: FLOW.md\n\n## Logging\n\nThe tool maintains detailed logs in `deploy.log`, including:\n\n- Timestamp for each operation\n- Command execution details\n- Success/failure status\n- Error messages and stack traces\n\n## Error Handling\n\nThe tool includes error handling for common scenarios:\n\n- Missing Dockerfile\n- SSH connection failures\n- Docker build/deployment errors\n- Container startup issues\n\n## Security Considerations\n\n- Uses SSH key-based authentication\n- Supports custom SSH key paths\n- Environment variables can be passed securely via env file\n- Build arguments can be used for sensitive build-time variables\n- No sensitive information is logged\n\n## Known Limitations\n\n1. Limited error recovery mechanisms\n2. Basic container health checking\n3. No support for complex Docker network configurations\n4. No Docker Compose support\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch\n3. Commit your changes\n4. Push to the branch\n5. Create a new Pull Request\n\n## Release Process\n\nNew versions are automatically built and released when a new tag is pushed:\n\n```bash\ngit tag v1.0.0\ngit push origin v1.0.0\n```\n\nThis will trigger the GitHub Action workflow to:\n\n1. Build binaries for multiple platforms\n2. Generate checksums\n3. Create a new release with the binaries\n\n## TODO\n\n- [ ] Improve error handling\n- [ ] Add support for Docker Compose\n- [ ] Implement proper container health checks\n- [ ] Add shell completion support\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Disclaimer\n\nThis is an experimental prototype. Use at your own risk. The authors assume no liability for the use of this tool. Always review the code and test in a safe environment before using in any critical systems.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjarneo%2Fpipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbjarneo%2Fpipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbjarneo%2Fpipe/lists"}