Skip to content

Commit

Permalink
Add docker installation (#112)
Browse files Browse the repository at this point in the history
  • Loading branch information
micnncim authored Feb 7, 2021
1 parent 7688f40 commit 54f41e3
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 0 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Docker

on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+

jobs:
docker:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
buildkitd-flags: --debug

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx/cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ github.repository_owner }}
password: ${{ secrets.DOCKER_PASSWORD }}

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

- name: Output version
id: version
run: |
echo ::set-output name=version::${GITHUB_REF##*/}
- name: Build and push
uses: docker/build-push-action@v2
with:
push: true
cache-from: type=local,src=/tmp/.buildx/cache
cache-to: type=local,dest=/tmp/.buildx/cache,mode=max
tags: |
${{ github.repository }}:latest
${{ github.repository }}:${{ steps.version.outputs.version }}
ghcr.io/${{ github.repository }}:latest
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM golang:1.15-alpine AS builder

WORKDIR /app
COPY . /app

RUN go build -o /bin/kubectl-reap ./cmd/kubectl-reap

FROM gcr.io/distroless/base-debian10

COPY --from=builder /bin/kubectl-reap /usr/bin
CMD ["kubectl-reap"]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

[![actions-workflow-test][actions-workflow-test-badge]][actions-workflow-test]
[![release][release-badge]][release]
[![docker][docker-badge]][docker]
[![codecov][codecov-badge]][codecov]
[![pkg.go.dev][pkg.go.dev-badge]][pkg.go.dev]
[![license][license-badge]][license]
Expand Down Expand Up @@ -50,6 +51,20 @@ $ brew install kubectl-reap
$ go get github.com/micnncim/kubectl-reap/cmd/kubectl-reap
```

### Via Docker

In Docker Hub:

```
$ docker run --rm -it micnncim/kubectl-reap kubectl-reap
```

In GitHub Container Registry:

```
$ docker run --rm -it ghcr.io/micnncim/kubectl-reap kubectl-reap
```

## Examples

### Pods
Expand Down Expand Up @@ -212,6 +227,9 @@ This plugin provides more flexible, easy way to delete resources.
[release]: https://github.com/micnncim/kubectl-reap/releases
[release-badge]: https://img.shields.io/github/v/release/micnncim/kubectl-reap?style=for-the-badge&logo=github

[docker]: https://hub.docker.com/repository/docker/micnncim/kubectl-reap
[docker-badge]: https://img.shields.io/docker/v/micnncim/kubectl-reap?sort=semver&style=for-the-badge&logo=docker

[codecov]: https://codecov.io/gh/micnncim/kubectl-reap
[codecov-badge]: https://img.shields.io/codecov/c/github/micnncim/kubectl-reap?style=for-the-badge&logo=codecov

Expand Down

0 comments on commit 54f41e3

Please sign in to comment.