Skip to content

Commit

Permalink
Merge pull request #302 from banzaicloud/docker-build
Browse files Browse the repository at this point in the history
build docker image
  • Loading branch information
pbalogh-sa authored Sep 18, 2020
2 parents 9cf6d29 + 3cb2c54 commit db72cd7
Show file tree
Hide file tree
Showing 3 changed files with 108 additions and 1 deletion.
55 changes: 55 additions & 0 deletions .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Docker Build
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"

jobs:
docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Checkout code
uses: actions/checkout@v2
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.ref }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Determine tag or commit
uses: haya14busa/action-cond@v1
id: refortag
with:
cond: ${{ startsWith(github.ref, 'refs/tags/') }}
if_true: ${{ github.ref }}
if_false: latest
- name: Determine image tag
id: imagetag
run: echo "::set-output name=value::${TAG_OR_BRANCH##*/}"
env:
TAG_OR_BRANCH: ${{ steps.refortag.outputs.value }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CR_PAT }}

- name: Build banzai-cli
uses: docker/build-push-action@v2
with:
tags: |
ghcr.io/banzaicloud/banzai-cli:latest
ghcr.io/banzaicloud/banzai-cli:${{ steps.imagetag.outputs.value }}
file: Dockerfile
push: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
30 changes: 30 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
ARG GO_VERSION=1.15
ARG FROM_IMAGE=alpine:latest

FROM golang:${GO_VERSION}-alpine3.12 AS builder
RUN apk add --update --no-cache bash ca-certificates make curl git mercurial tzdata

# Install kubectl
ARG KUBECTL_VERSION=v1.16.1
RUN curl -L -s https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl -o /usr/local/bin/kubectl
RUN curl -L -s https://amazon-eks.s3-us-west-2.amazonaws.com/1.14.6/2019-08-22/bin/linux/amd64/aws-iam-authenticator -o /usr/local/bin/aws-iam-authenticator

RUN chmod +x /usr/local/bin/*

RUN mkdir -p /build
WORKDIR /build

COPY go.* /build/
RUN go mod download

ARG VERSION

COPY . /build
RUN make build-release

FROM ${FROM_IMAGE}
RUN apk add --update --no-cache openssh-client
COPY --from=builder /usr/local/bin/* /bin/
COPY --from=builder /build/build/banzai /bin/

ENTRYPOINT [ "/bin/banzai" ]
24 changes: 23 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This is a command-line interface under heavy development for the [Banzai Cloud Pipeline](https://beta.banzaicloud.io/) platform.
This is a command-line interface for the [Banzai Cloud Pipeline](https://try.pipeline.banzai.cloud/) platform.

### Installation

Expand Down Expand Up @@ -44,3 +44,25 @@ For interactive login, just run `banzai login`, and follow the instructions give
### Use

See [command reference](https://banzaicloud.com/docs/pipeline/cli/reference/) in the [official documentation](https://banzaicloud.com/docs/pipeline/cli/).

### Use Docker image

Logging in
```
$ docker run --rm -v $(PWD)/banzai-cli:/root/ ghcr.io/banzaicloud/banzai-cli login --token <your-pipeline-token> -e https://try.pipeine.banzai.cloud/pipeline
```

Select organization
```
$ docker run --rm -ti -v $(PWD)/banzai-cli:/root/ ghcr.io/banzaicloud/banzai-cli organization select
```

List clusters
```
$ docker run --rm -ti -v $(PWD)/banzai-cli:/root/ ghcr.io/banzaicloud/banzai-cli cluster list
```

Run cluster shell
```
$ docker run --rm -ti -v $(PWD)/banzai-cli:/root/ ghcr.io/banzaicloud/banzai-cli cluster shell
```

0 comments on commit db72cd7

Please sign in to comment.