Skip to content

Commit

Permalink
Merge pull request #61 from Icinga/container
Browse files Browse the repository at this point in the history
Container
  • Loading branch information
lippserd authored Jan 18, 2024
2 parents 7bd16ec + 5df3e8a commit f235997
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Docker Image

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
icinga/icinga-kubernetes
tags: |
type=edge
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PERSONAL_TOKEN }}

- name: Build and push
uses: docker/build-push-action@v5
with:
file: Containerfile
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
14 changes: 14 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
FROM golang AS build

WORKDIR /build
COPY go.mod go.sum ./
RUN go mod download

COPY . .
RUN CGO_ENABLED=0 GOOS=linux go build -o /icinga-kubernetes cmd/icinga-kubernetes/main.go

FROM scratch

COPY --from=build /icinga-kubernetes /icinga-kubernetes

CMD ["/icinga-kubernetes"]
11 changes: 11 additions & 0 deletions doc/02-Installation.md.d/From-Source.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,14 @@ With locally accessible kubeconfig and `config.yml` files, `icinga-kubernetes` c
```bash
icinga-kubernetes -config /path/to/config.yml [-kubeconfig $HOME/.kube/config]
```

## Using a Container

With locally accessible kubeconfig and `config.yml` files,
run the `icinga/icinga-kubernetes` image using a container runtime of you choice, e.g. Docker:

```bash
export KUBECONFIG=$HOME/.kube/config
export ICINGA_KUBERNETES_CONFIG=config.yml
docker run --rm --network=host -v $ICINGA_KUBERNETES_CONFIG:/config.yml -v $KUBECONFIG:/.kube/config icinga/icinga-kubernetes
```

0 comments on commit f235997

Please sign in to comment.