Skip to content

Commit 54f41e3

Browse files
authored
Add docker installation (#112)
1 parent 7688f40 commit 54f41e3

File tree

3 files changed

+90
-0
lines changed

3 files changed

+90
-0
lines changed

.github/workflows/docker.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
tags:
6+
- v[0-9]+.[0-9]+.[0-9]+
7+
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v2
15+
16+
- name: Set up QEMU
17+
uses: docker/setup-qemu-action@v1
18+
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v1
21+
with:
22+
version: latest
23+
buildkitd-flags: --debug
24+
25+
- name: Cache Docker layers
26+
uses: actions/cache@v2
27+
with:
28+
path: /tmp/.buildx/cache
29+
key: ${{ runner.os }}-buildx-${{ github.sha }}
30+
restore-keys: |
31+
${{ runner.os }}-buildx-
32+
33+
- name: Login to DockerHub
34+
uses: docker/login-action@v1
35+
with:
36+
username: ${{ github.repository_owner }}
37+
password: ${{ secrets.DOCKER_PASSWORD }}
38+
39+
- name: Login to GitHub Container Registry
40+
uses: docker/login-action@v1
41+
with:
42+
registry: ghcr.io
43+
username: ${{ github.repository_owner }}
44+
password: ${{ secrets.GHCR_TOKEN }}
45+
46+
- name: Output version
47+
id: version
48+
run: |
49+
echo ::set-output name=version::${GITHUB_REF##*/}
50+
51+
- name: Build and push
52+
uses: docker/build-push-action@v2
53+
with:
54+
push: true
55+
cache-from: type=local,src=/tmp/.buildx/cache
56+
cache-to: type=local,dest=/tmp/.buildx/cache,mode=max
57+
tags: |
58+
${{ github.repository }}:latest
59+
${{ github.repository }}:${{ steps.version.outputs.version }}
60+
ghcr.io/${{ github.repository }}:latest
61+
ghcr.io/${{ github.repository }}:${{ steps.version.outputs.version }}

Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
FROM golang:1.15-alpine AS builder
2+
3+
WORKDIR /app
4+
COPY . /app
5+
6+
RUN go build -o /bin/kubectl-reap ./cmd/kubectl-reap
7+
8+
FROM gcr.io/distroless/base-debian10
9+
10+
COPY --from=builder /bin/kubectl-reap /usr/bin
11+
CMD ["kubectl-reap"]

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
[![actions-workflow-test][actions-workflow-test-badge]][actions-workflow-test]
44
[![release][release-badge]][release]
5+
[![docker][docker-badge]][docker]
56
[![codecov][codecov-badge]][codecov]
67
[![pkg.go.dev][pkg.go.dev-badge]][pkg.go.dev]
78
[![license][license-badge]][license]
@@ -50,6 +51,20 @@ $ brew install kubectl-reap
5051
$ go get github.com/micnncim/kubectl-reap/cmd/kubectl-reap
5152
```
5253

54+
### Via Docker
55+
56+
In Docker Hub:
57+
58+
```
59+
$ docker run --rm -it micnncim/kubectl-reap kubectl-reap
60+
```
61+
62+
In GitHub Container Registry:
63+
64+
```
65+
$ docker run --rm -it ghcr.io/micnncim/kubectl-reap kubectl-reap
66+
```
67+
5368
## Examples
5469

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

230+
[docker]: https://hub.docker.com/repository/docker/micnncim/kubectl-reap
231+
[docker-badge]: https://img.shields.io/docker/v/micnncim/kubectl-reap?sort=semver&style=for-the-badge&logo=docker
232+
215233
[codecov]: https://codecov.io/gh/micnncim/kubectl-reap
216234
[codecov-badge]: https://img.shields.io/codecov/c/github/micnncim/kubectl-reap?style=for-the-badge&logo=codecov
217235

0 commit comments

Comments
 (0)