Skip to content

Commit 768fde1

Browse files
committed
Initial Commit
0 parents  commit 768fde1

8 files changed

Lines changed: 154 additions & 0 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.github

.github/CONTRIBUTING.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
Thank you for contributing docker-ibmcloud-login
2+
=====================================================
3+
4+
If you're reading this, you're awesome! Thank you for helping us make this project great and being.
5+
Here are a few guidelines that will help you along the way.
6+
7+
## You first Pull Request
8+
9+
Working on your first Pull request?
10+
11+
If you decide to fix and issue, please be sure to check the comment thread in case somebody is
12+
already working on a fix. If nobody is working on it at the moment, please leave a comment stating
13+
that you have started to work on it so other people dont't accidentally duplicate your effort.
14+
15+
## Sending a Pull Request
16+
17+
docker-ibmcloud-login is a community project, so pull requests are always welcome, but before working on a large change, it is best to open an issue first to discuss it with the maintainers.
18+
19+
When in doubt, keep your pull requests small. To give a PR the best chance of getting accepted, don't bundle more than one feature or bug fix per pull request. It's always best to create two smaller PRs than one big one.

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build
2+
3+
on: [push]
4+
5+
env:
6+
REGISTRY_HOSTNAME: oda2
7+
IMAGE_NAME: ibmcloud-login
8+
9+
jobs:
10+
build:
11+
name: Build Image
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout repo
15+
uses: actions/checkout@v2
16+
17+
- name: build
18+
env:
19+
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
20+
run: |
21+
docker build -t "$REGISTRY_HOSTNAME"/"$IMAGE_NAME":"$IMAGE_TAG" .

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Release
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
env:
8+
REGISTRY_HOSTNAME: oda2
9+
IMAGE_NAME: ibmcloud-cli
10+
11+
jobs:
12+
build:
13+
name: Build Image
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v2
18+
19+
- name: Set output
20+
id: vars
21+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
22+
23+
- name: Login to DockerHub
24+
uses: docker/login-action@v1
25+
with:
26+
username: ${{ secrets.DOCKERHUB_USERNAME }}
27+
password: ${{ secrets.DOCKERHUB_TOKEN }}
28+
29+
- name: build
30+
env:
31+
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
32+
run: |
33+
docker build -t "$REGISTRY_HOSTNAME"/"$IMAGE_NAME":"$IMAGE_TAG" .
34+
35+
- name: Push the image on DockerHub
36+
env:
37+
IMAGE_TAG: ${{ steps.vars.outputs.tag }}
38+
run: docker push $REGISTRY_HOSTNAME:$IMAGE_NAME:$IMAGE_TAG

Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM alpine:3
2+
MAINTAINER Renato Oda <renato.oda2@gmail.com>
3+
4+
WORKDIR /app
5+
6+
RUN apk update && apk add bash curl docker
7+
RUN curl -fsSL https://clis.cloud.ibm.com/install/linux | sh
8+
RUN ibmcloud --version && \
9+
ibmcloud config --check-version=false && \
10+
ibmcloud plugin install -f kubernetes-service && \
11+
ibmcloud plugin install -f container-registry && \
12+
ibmcloud plugin install -f schematics && \
13+
ibmcloud plugin install -f cloud-object-storage
14+
15+
COPY bootstrap.sh .
16+
RUN chmod a+x ./bootstrap.sh
17+
18+
ENTRYPOINT ["./bootstrap.sh"]
19+
20+
CMD ["/bin/bash"]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 Renato Oda
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# IBMCLOUD CLI
2+
3+
> A minimal container containing the CLI tools required for use in the IBMCloud
4+
5+
## Prerequisites
6+
7+
- Docker
8+
- IBM API Key [IAM API Keys](https://cloud.ibm.com/iam/apikeys)
9+
10+
11+
## Getting started
12+
13+
Launch the container as follows:
14+
15+
```sh
16+
docker run -it \
17+
--name ibmcloud-cli \
18+
-e IBM_CLOUD_API_KEY=MY_API_KEY \
19+
-e IBM_CLOUD_REGION=MY_REGION \
20+
oda2/ibmcloud-cli sh
21+
```
22+
23+
## How is this useful?
24+
25+
Instead of using the ibmcloud login installation in our CI, this container will always provide the ready-to-use CLI.

bootstrap.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
ibmcloud login --apikey "${IBM_CLOUD_API_KEY}" -r "${IBM_CLOUD_REGION}"
6+
ibmcloud cr region-set "${IBM_CLOUD_REGION}"
7+
ibmcloud cr login
8+
9+
/bin/bash

0 commit comments

Comments
 (0)