From 27eec35ba5fc75d8b216fbbae9b34fed927d8205 Mon Sep 17 00:00:00 2001 From: evgenyKharitonov Date: Mon, 24 Jul 2023 14:58:43 +0300 Subject: [PATCH] add dockerfile and ci workflows --- .github/workflows/pull_request.yaml | 28 ++++++++++ .github/workflows/release.yaml | 35 +++++++++++++ Dockerfile | 22 ++++++++ README.md | 81 ++++++++++++++++++++++++++++- 4 files changed, 165 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pull_request.yaml create mode 100644 .github/workflows/release.yaml create mode 100644 Dockerfile diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml new file mode 100644 index 0000000..c83c83e --- /dev/null +++ b/.github/workflows/pull_request.yaml @@ -0,0 +1,28 @@ +name: Build Docker image + +on: + pull_request: + types: ["opened", "synchronize", "reopened"] + +jobs: + build_docker_image: + name: Build Docker image + runs-on: ubuntu-20.04 + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + tailordevdockermachine/podPeeper + + - name: Build and wihtout push Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: false + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..03c2601 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,35 @@ +name: Publish Docker image + +on: + push: + branches: + - "master" + +jobs: + push_to_registries: + name: Push Docker image to Dockerhub + runs-on: ubuntu-20.04 + steps: + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Log in to Docker Hub + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v4 + with: + images: | + tailordevdockermachine/podPeeper + + - name: Build and push Docker images + uses: docker/build-push-action@v4 + with: + context: . + push: true + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..1b43bc0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +FROM alpine:3.18.2 + + +RUN apk update && apk add \ + postgresql-client \ + curl \ + nmap \ + curl \ + netcat-openbsd \ + tcpdump \ + bind-tools \ + jq \ + bash \ + bash-completion \ + && apk add --repository=https://dl-cdn.alpinelinux.org/alpine/edge/testing/ --no-cache \ + grpcurl \ + wget \ + vim \ + tmux \ + unzip + +CMD ["/bin/bash"] diff --git a/README.md b/README.md index c2b7c30..fab00e4 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,81 @@ # PodPeeper -PodPeeper is a simple Dockerfile that used for starting a pod in a kubernetes cluster with common tools + +## Docker Image for Kubernetes Debugging + +This repository contains a Dockerfile that builds a lightweight Alpine-based image with essential debugging tools installed. The image is designed to be used as a pod in Kubernetes for debugging purposes, providing easy access to various tools that can aid in troubleshooting and inspecting network-related issues. + +## Usage with kubectl + +To use this Docker image for debugging in Kubernetes using `kubectl`, you can run the following command: + +```bash +kubectl run debug --rm -i --tty --image tailordevdockermachine/podpeeper:latest -- bash +``` + +This `kubectl` command will create a temporary pod named "debug" using the specified Docker image. It will allocate an interactive terminal and attach it to the pod, allowing you to use the included debugging tools directly within the Kubernetes environment. The pod will be automatically removed once you exit the debugging session. + +## Tools Included + +The Docker image is based on Alpine Linux 3.18.2 and comes pre-installed with the following debugging tools: + +- `postgresql-client`: PostgreSQL client for connecting to and interacting with PostgreSQL databases. +- `curl`: Command-line tool for making HTTP requests and transfers. +- `nmap`: Network exploration tool and security scanner. +- `netcat-openbsd`: Feature-rich networking utility for reading and writing data across network connections. +- `tcpdump`: Packet analyzer that captures and inspects network traffic. +- `bind-tools`: Set of DNS utilities, including `dig` and `nslookup`. +- `jq`: Lightweight and flexible command-line JSON processor. +- `bash`: GNU Bourne-Again SHell, a powerful command-line interpreter. +- `bash-completion`: Bash tab completion support. +- `grpcurl`: Command-line tool for interacting with gRPC servers. +- `wget`: Command-line utility for downloading files from the web. +- `vim`: Feature-rich text editor, ideal for quick file editing. +- `tmux`: Terminal multiplexer for managing multiple terminal sessions within a single window. +- `unzip`: Command-line utility for extracting ZIP archives. + +## Getting Started + +To use this Docker image outside of Kubernetes, you can pull it directly from DockerHub or build it locally using the provided Dockerfile. + +### Pull from DockerHub + +You can pull the latest version of the image from DockerHub using the following command: + +```bash +docker pull tailordevdockermachine/podpeeper:latest +``` + + +### Build Locally + +If you prefer to build the image locally, follow these steps: + +1. Clone this repository to your local machine: + +```bash +git clone https://github.com/TailorBrands/PodPeeper +``` + +2. Change into the repository directory: + +```bash +cd PodPeeper +``` + +3. Build the Docker image using the following command: + +```bash +docker build -t : . +``` + +Replace `` and `` with your desired image name and version. + +## Contributing + +If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request. We welcome contributions from the community! + +## License + +This project is licensed under the MIT License. + +**Note**: This Docker image is intended for debugging purposes and might contain various tools that could be used for troubleshooting and network inspection. Ensure proper authorization and usage when deploying it in production environments.