|
1 | | -# IBMCloud CLI |
| 1 | +<div align="center"> |
2 | 2 |
|
3 | | -> A minimal container containing the CLI tools required for use in the IBMCloud |
| 3 | +> ⚠️ **Maintenance Notice** |
| 4 | +> |
| 5 | +> This repository is **no longer actively maintained**. Since its creation, IBM Cloud tools have evolved significantly, and I no longer use IBM Cloud in my daily work. The image may still work, but I won't be providing updates or support. |
| 6 | +> |
| 7 | +> Consider using [IBM Cloud Official Docker Images](https://github.com/IBM/ibmcloud-docker-image) or the [IBM Cloud CLI directly](https://github.com/IBM/ibmcloud-cli). |
4 | 8 |
|
5 | | -[](https://www.codacy.com/gh/Oda2/docker-ibmcloud-cli/dashboard?utm_source=github.com&utm_medium=referral&utm_content=Oda2/docker-ibmcloud-cli&utm_campaign=Badge_Grade) |
6 | | - |
7 | | -[](https://github.com/Oda2/docker-ibmcloud-cli/blob/main/LICENSE) |
8 | | -[](https://hub.docker.com/r/oda2/ibmcloud-cli) |
9 | | -[](https://app.fossa.com/projects/git%2Bgithub.com%2FOda2%2Fdocker-ibmcloud-cli?ref=badge_shield) |
| 9 | + |
10 | 10 |
|
11 | | -## Prerequisites |
| 11 | +# IBMCloud CLI Docker Image |
12 | 12 |
|
13 | | -- Docker |
14 | | -- IBM API Key [IAM API Keys](https://cloud.ibm.com/iam/apikeys) |
| 13 | +### A minimalist Docker image with IBMCloud CLI ready for CI/CD and development |
15 | 14 |
|
16 | | -## Getting started |
| 15 | +[](https://hub.docker.com/r/oda2/ibmcloud-cli) |
| 16 | +[](https://hub.docker.com/r/oda2/ibmcloud-cli) |
| 17 | +[](https://github.com/Oda2/docker-ibmcloud-cli) |
| 18 | +[](LICENSE) |
| 19 | +[](https://github.com/Oda2/docker-ibmcloud-cli/actions) |
17 | 20 |
|
18 | | -Launch the container as follows: |
| 21 | +--- |
19 | 22 |
|
20 | | -```sh |
| 23 | +## ✨ Why Use This? |
| 24 | + |
| 25 | +- ✅ **Zero installation** - Comes with IBMCloud CLI and all plugins pre-installed |
| 26 | +- ✅ **CI/CD ready** - Set environment variables and you're ready to go |
| 27 | +- ✅ **Small footprint** - Alpine-based image for minimal size |
| 28 | +- ✅ **Always up-to-date** - ~~Automatic builds with the latest version~~ (builds paused) |
| 29 | + |
| 30 | +</div> |
| 31 | + |
| 32 | +--- |
| 33 | + |
| 34 | +## 📋 Table of Contents |
| 35 | + |
| 36 | +- [Quick Start](#quick-start) |
| 37 | +- [Environment Variables](#environment-variables) |
| 38 | +- [CI/CD Usage](#cicd-usage) |
| 39 | +- [Installed Plugins](#installed-plugins) |
| 40 | +- [Advanced Examples](#advanced-examples) |
| 41 | +- [Contributing](#contributing) |
| 42 | +- [License](#license) |
| 43 | + |
| 44 | +--- |
| 45 | + |
| 46 | +## 🚀 Quick Start |
| 47 | + |
| 48 | +### Basic Usage |
| 49 | + |
| 50 | +```bash |
21 | 51 | docker run -it \ |
22 | | - --name ibmcloud-cli \ |
23 | | - -e IBM_CLOUD_API_KEY=MY_API_KEY \ |
24 | | - -e IBM_CLOUD_REGION=MY_REGION \ |
25 | | - oda2/ibmcloud-cli sh |
| 52 | + -e IBM_CLOUD_API_KEY=$IBM_CLOUD_API_KEY \ |
| 53 | + -e IBM_CLOUD_REGION=us-south \ |
| 54 | + oda2/ibmcloud-cli |
| 55 | +``` |
| 56 | + |
| 57 | +### With Docker Compose |
| 58 | + |
| 59 | +```yaml |
| 60 | +services: |
| 61 | + ibmcloud: |
| 62 | + image: oda2/ibmcloud-cli |
| 63 | + environment: |
| 64 | + IBM_CLOUD_API_KEY: ${IBM_CLOUD_API_KEY} |
| 65 | + IBM_CLOUD_REGION: us-south |
| 66 | + volumes: |
| 67 | + - ./scripts:/scripts |
| 68 | + command: /bin/bash |
| 69 | +``` |
| 70 | +
|
| 71 | +--- |
| 72 | +
|
| 73 | +## 🔧 Environment Variables |
| 74 | +
|
| 75 | +| Variable | Required | Description | Default | |
| 76 | +|----------|----------|-------------|---------| |
| 77 | +| `IBM_CLOUD_API_KEY` | ✅ | Your IBM Cloud API Key | - | |
| 78 | +| `IBM_CLOUD_REGION` | ✅ | Region for login | `us-south` | |
| 79 | +| `IBM_CLOUD_RESOURCE_GROUP` | ❌ | Resource group | `default` | |
| 80 | + |
| 81 | +> 🔐 **Tip**: Never expose your API Key in public repositories! Use CI/CD secrets. |
| 82 | + |
| 83 | +--- |
| 84 | + |
| 85 | +## 🔄 CI/CD Usage |
| 86 | + |
| 87 | +### GitHub Actions |
| 88 | + |
| 89 | +```yaml |
| 90 | +jobs: |
| 91 | + deploy: |
| 92 | + runs-on: ubuntu-latest |
| 93 | + steps: |
| 94 | + - name: Login to IBM Cloud |
| 95 | + uses: oda2/docker-ibmcloud-cli@v1 |
| 96 | + with: |
| 97 | + api-key: ${{ secrets.IBM_CLOUD_API_KEY }} |
| 98 | + region: us-south |
| 99 | +
|
| 100 | + - name: List clusters |
| 101 | + run: ibmcloud ks cluster ls |
| 102 | +``` |
| 103 | + |
| 104 | +### GitLab CI |
| 105 | + |
| 106 | +```yaml |
| 107 | +deploy: |
| 108 | + image: oda2/ibmcloud-cli |
| 109 | + variables: |
| 110 | + IBM_CLOUD_API_KEY: $IBM_CLOUD_API_KEY |
| 111 | + IBM_CLOUD_REGION: us-south |
| 112 | + script: |
| 113 | + - ibmcloud ks cluster ls |
| 114 | +``` |
| 115 | + |
| 116 | +### Jenkins |
| 117 | + |
| 118 | +```groovy |
| 119 | +pipeline { |
| 120 | + agent { |
| 121 | + docker { |
| 122 | + image 'oda2/ibmcloud-cli' |
| 123 | + args '-e IBM_CLOUD_API_KEY=$IBM_CLOUD_API_KEY -e IBM_CLOUD_REGION=us-south' |
| 124 | + } |
| 125 | + } |
| 126 | + stages { |
| 127 | + stage('Deploy') { |
| 128 | + steps { |
| 129 | + sh 'ibmcloud ks cluster ls' |
| 130 | + } |
| 131 | + } |
| 132 | + } |
| 133 | +} |
| 134 | +``` |
| 135 | + |
| 136 | +### Azure DevOps |
| 137 | + |
| 138 | +```yaml |
| 139 | +- task: Docker@2 |
| 140 | + inputs: |
| 141 | + command: 'run' |
| 142 | + imageName: 'oda2/ibmcloud-cli' |
| 143 | + containerCommand: 'ibmcloud ks cluster ls' |
| 144 | + envVars: | |
| 145 | + IBM_CLOUD_API_KEY=$(IBM_CLOUD_API_KEY) |
| 146 | + IBM_CLOUD_REGION=us-south |
| 147 | +``` |
| 148 | + |
| 149 | +--- |
| 150 | + |
| 151 | +## 📦 Installed Plugins |
| 152 | + |
| 153 | +| Plugin | Description | |
| 154 | +|--------|-------------| |
| 155 | +| `kubernetes-service` | Kubernetes cluster management (IKS) | |
| 156 | +| `container-registry` | Docker image management in IBM Cloud Container Registry | |
| 157 | +| `schematics` | Infrastructure as Code (IaC) with Terraform | |
| 158 | +| `cloud-object-storage` | Object Storage management | |
| 159 | + |
| 160 | +### Checking Plugins |
| 161 | + |
| 162 | +```bash |
| 163 | +$ ibmcloud plugin list |
| 164 | +
|
| 165 | +Listing installed plug-ins... |
| 166 | +
|
| 167 | +Plugin Name Version Status |
| 168 | +cloud-object-storage 1.3.1 Update Available |
| 169 | +container-registry 0.1.567 Update Available |
| 170 | +kubernetes-service 0.3.254 Update Available |
| 171 | +schematics 0.0.27 Update Available |
| 172 | +``` |
| 173 | + |
| 174 | +--- |
| 175 | + |
| 176 | +## 💡 Advanced Examples |
| 177 | + |
| 178 | +### Running Specific Commands |
| 179 | + |
| 180 | +```bash |
| 181 | +docker run --rm \ |
| 182 | + -e IBM_CLOUD_API_KEY=$IBM_CLOUD_API_KEY \ |
| 183 | + -e IBM_CLOUD_REGION=us-south \ |
| 184 | + oda2/ibmcloud-cli ibmcloud ks cluster ls |
26 | 185 | ``` |
27 | 186 |
|
28 | | -## Plugins Installed default |
| 187 | +### Using with Kubernetes |
| 188 | + |
| 189 | +```bash |
| 190 | +# Authenticate and get cluster credentials |
| 191 | +docker run --rm \ |
| 192 | + -e IBM_CLOUD_API_KEY=$IBM_CLOUD_API_KEY \ |
| 193 | + -e IBM_CLOUD_REGION=us-south \ |
| 194 | + oda2/ibmcloud-cli ibmcloud ks cluster config --cluster my-cluster |
| 195 | +
|
| 196 | +# Download kubeconfig |
| 197 | +docker run --rm \ |
| 198 | + -e IBM_CLOUD_API_KEY=$IBM_CLOUD_API_KEY \ |
| 199 | + -e IBM_CLOUD_REGION=us-south \ |
| 200 | + -v $(pwd):/output \ |
| 201 | + oda2/ibmcloud-cli ibmcloud ks cluster config --cluster my-cluster --export > /output/kubeconfig |
| 202 | +``` |
| 203 | + |
| 204 | +### Build and Push Images |
| 205 | + |
| 206 | +```bash |
| 207 | +docker run --rm \ |
| 208 | + -e IBM_CLOUD_API_KEY=$IBM_CLOUD_API_KEY \ |
| 209 | + -e IBM_CLOUD_REGION=us-south \ |
| 210 | + -v /var/run/docker.sock:/var/run/docker.sock \ |
| 211 | + -v $(pwd):/app \ |
| 212 | + oda2/ibmcloud-cli sh -c " |
| 213 | + ibmcloud cr build -t registry.us-south.io/myapp:latest /app |
| 214 | + " |
| 215 | +``` |
| 216 | + |
| 217 | +--- |
| 218 | + |
| 219 | +## 🤝 Contributing |
| 220 | + |
| 221 | +Contributions are welcome! See our [Contribution Guide](./.github/CONTRIBUTING.md). |
| 222 | + |
| 223 | +1. Fork the project |
| 224 | +2. Create your branch (`git checkout -b feature/amazing-feature`) |
| 225 | +3. Commit your changes (`git commit -m 'Add amazing feature'`) |
| 226 | +4. Push to the branch (`git push origin feature/amazing-feature`) |
| 227 | +5. Open a Pull Request |
| 228 | + |
| 229 | +--- |
| 230 | + |
| 231 | +## 📄 License |
| 232 | + |
| 233 | +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. |
| 234 | + |
| 235 | +--- |
29 | 236 |
|
30 | | -- kubernetes-service |
31 | | -- container-registry |
32 | | -- schematics |
33 | | -- cloud-object-storage |
| 237 | +<div align="center"> |
34 | 238 |
|
35 | | -## How is this useful |
| 239 | +### ⭐ Like it? Leave a star! |
36 | 240 |
|
37 | | -Instead of using the ibmcloud login installation in our CI, this container will always provide the ready-to-use CLI. |
| 241 | +[](https://github.com/Oda2/docker-ibmcloud-cli) |
38 | 242 |
|
39 | | -### License |
40 | | -Licensed under [MIT](https://github.com/Oda2/docker-ibmcloud-cli/blob/main/LICENSE) |
| 243 | +Made with ❤️ by [Renato Oda](https://github.com/Oda2) |
41 | 244 |
|
42 | | -[](https://app.fossa.com/projects/git%2Bgithub.com%2FOda2%2Fdocker-ibmcloud-cli?ref=badge_large) |
| 245 | +</div> |
0 commit comments