Sign inSign up

emilioforrer/ci-tools

By emilioforrer

•Updated over 4 years ago

A Docker Hub image for CI/CD deployments, with tools like docker-compose, kind, kubectl, helm, etc

Image
0

10K+

emilioforrer/ci-tools repository overview

⁠CI Tools - Docker hub image


⁠Description


CI Tools⁠ is a Docker Hub⁠ image for CI/CD deployments, with tools like curl, dind, docker-compose, kind, kubectl, helm, vault, 1password, semver-cli, argo-cd, bitwarden, waypoint, earthly etc.

⁠Tools and dependencies
NameVersionCommand
git2.34.1git version
bash5.1.8(1)-releasebash --version
yq2.13.0yq --version
jqv3.15.0_alpha20210804-4073jq --version
curl7.80.0curl --version
docker20.10.12docker --version
docker-compose1.29.2docker-compose --version
kind0.11.1kind --version
kubectlv1.23.3kubectl version --client
helmv3.8.0helm version
vaultv1.9.3vault --version
1password1.12.4op --version
bitwarden1.21.0bw --version
semver-cli1.1.0--
argocdv2.2.5+8f981ccargocd version --client
waypointv0.7.1waypoint --version
earthlyv0.6.7earthly --version

Note: to see a list of changes for supported tags and dependency versions, please see the CHANGELOG.md⁠

⁠Usage

⁠Bash

This image has a custom colored bash and prints the STERR in red color and new extra commands:

Note: in order to set up the bash and import the commands, you can run source /scripts/.bashrc;

⁠Command - generate_service_account_kubeconfig

Is a new command that generates a kubeconfig file based on the service account token⁠, while running in a pod.

e.g.

generate_service_account_kubeconfig;
export KUBECONFIG="$(pwd)/kubeconfig";

With parameters (API_SERVER, FILE_NAME)

generate_service_account_kubeconfig "https://kubernetes.default.svc.cluster.local" "kubeconfig-dev";
export KUBECONFIG="$(pwd)/kubeconfig-dev";
⁠Command - println

Is a new command that accepts as a first parameter a color and a second parameter a text to print (if no color given, it prints the text with the default color).

e.g.

Print the text in red color hello

println r "hello"

Print the text as warning (yellow) color hello

println warn "hello"

Print the text in cyan color hello

println cyan "hello"

Print the text in default color hello

println "hello"

List of colors

NameShort name
blackbk
redr
greeng
yellowy
blueb
purplep
cyanc
whitewh
infoi
warn (yellow)w
error (red)e
sucsess (green)ok
⁠DIND (Docker in Docker)

DIND⁠ is a way to run Docker inside a Docker container (for example, to pull and build images, or to run other containers) in your CI/CD system.

docker run --rm -it \
           -v /var/run/docker.sock:/var/run/docker.sock \
           emilioforrer/ci-tools:latest \
           bash

Inside the image you can run sudo docker version or

docker run --rm -it \
           -v /var/run/docker.sock:/var/run/docker.sock \
           emilioforrer/ci-tools:latest \
           sudo docker version
⁠Docker compose

Docker compose⁠ is a tool for defining and running multi-container Docker applications. With Compose, you use a YAML file to configure your application's services.

e.g. Create a docker-compose.yaml file.

cat << EOF > docker-compose.yaml
version: "3.7"
services:
  nginx-hello:
    image: emilioforrer/nginx-hello
    ports:
      - '8000:80'
  ruby-hello:
    image: emilioforrer/ruby-hello
    network_mode: "host"
    ports:
      - '5000:5000'
  python-hello:
    image: emilioforrer/python-hello
    network_mode: "host"
    ports:
      - '5000:5000'
  nodejs-hello:
    image: emilioforrer/nodejs-hello
    network_mode: "host"
    environment:
      URLS: 'http://0.0.0.0:7000,http://0.0.0.0:3000,http://0.0.0.0:4000,http://0.0.0.0:5000'
    ports:
      - '9000:9000'
  php-hello:
    image: emilioforrer/php-hello
    network_mode: "host"
    ports:
      - '7000:7000'
  elixir-hello:
    image: emilioforrer/elixir-hello
    network_mode: "host"
    ports:
      - '4000:4000'
    environment:
      RUBY_URL: 'http://0.0.0.0:3000'
      PHP_URL: 'http://0.0.0.0:7000'
EOF

And then run

docker run --rm -it \
           -v /var/run/docker.sock:/var/run/docker.sock \
           -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           sudo docker-compose up

Now open your favorite browser and visit http://localhost:5001/

⁠KIND (Kubernetes In Docker)

KIND⁠ kind is a tool for running local Kubernetes clusters using Docker container "nodes". kind was primarily designed for testing Kubernetes itself, but may be used for local development or CI.

e.g.

docker run --rm -it \
           -v /var/run/docker.sock:/var/run/docker.sock \
           -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           sudo kind create cluster
⁠Kubectl

Kubectl⁠ Kubectl is a command line tool for controlling Kubernetes clusters.

e.g.

docker run --rm -v "$KUBECONFIG:$KUBECONFIG" \
           -e KUBECONFIG=$KUBECONFIG \
           emilioforrer/ci-tools:latest kubectl version
⁠Helm

Helm⁠ Helm is the best way to find, share, and use software built for Kubernetes.

docker run -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           helm version
⁠GIT

Git⁠ is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

e.g. Clonning a repository in the current working directory of the host.

docker run -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           git clone https://github.com/emilioforrer/ci-tools.git
⁠yq

yq⁠ is a lightweight and portable command-line YAML processor

e.g. Create a yaml and get a node.

cat <<EOF > pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: myapp-pod
  labels:
    app: myapp
spec:
  containers:
  - name: myapp-container
    image: busybox
    command: ['sh', '-c', 'echo Hello Kubernetes! && sleep 3600']
EOF

Get the container name

docker run -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           yq '.spec.containers[0].name' pod.yaml
⁠jq

jq⁠ is like sed for JSON data - you can use it to slice and filter and map and transform structured data with the same ease that sed, awk, grep and friends let you play with text.

e.g. Create a json and get a node.

cat <<EOF > pod.json
{
  "apiVersion": "v1",
  "kind": "Pod",
  "metadata": {
    "name": "myapp-pod",
    "labels": {
      "app": "myapp"
    }
  },
  "spec": {
    "containers": [
      {
        "name": "myapp-container",
        "image": "busybox",
        "command": [
          "sh",
          "-c",
          "echo Hello Kubernetes! && sleep 3600"
        ]
      }
    ]
  }
}
EOF

Get the container name

docker run -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           jq '.spec.containers[0].name' pod.json
⁠curl

curl⁠ is used in command lines or scripts to transfer data. It is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, settop boxes, media players and is the internet transfer backbone for thousands of software applications affecting billions of humans daily.

e.g

docker run -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           curl -fG https://raw.githubusercontent.com/emilioforrer/ci-tools/develop/README.md > README.md
⁠Vault CLI

vault⁠ is a secure, store and tightly control access to tokens, passwords, certificates, encryption keys for protecting secrets and other sensitive data using a UI, CLI, or HTTP API.

e.g

docker run -v $(pwd)/:/home/developer/workspace \
           emilioforrer/ci-tools:latest \
           vault --version
⁠1Password CLI

1Password⁠ with 1Password you only ever need to memorize one password. All your other passwords and important information are protected by your Master Password, which only you know. e.g

docker run -it emilioforrer/ci-tools:latest op --version
⁠Bitwarden CLI

Bitwarden⁠ Open Source Password Management for You and Your Business. he easiest and safest way for individuals and businesses to store, share, and secure sensitive data on any device e.g

docker run -it emilioforrer/ci-tools:latest bw --version
⁠Waypoint CLI

waypoint-cli⁠ allows developers to deploy, manage, and observe their applications through a consistent abstraction of underlying infrastructure. e.g

docker run -it emilioforrer/ci-tools:latest waypoint --help
⁠Earthly CLI

earthly-cli⁠ is a syntax for defining your build. It works with your existing build system. Get repeatable and understandable builds today. e.g

# In order to use `earthly bootstrap` inside the image without sudo, you need to add `--group-add $(stat -c '%g' /var/run/docker.sock)` 
docker run -it -v /var/run/docker.sock:/var/run/docker.sock --group-add $(stat -c '%g' /var/run/docker.sock) emilioforrer/ci-tools:latest earthly --help
⁠Semver CLI

semver-cli⁠ is a simple command line tool to compare and manipulate version strings. e.g

docker run -it emilioforrer/ci-tools:latest semver --help

⁠Development

⁠Scripts
⁠Build Docker image
# Build Docker image
./build.sh
# Build and push Docker image
DOCKER_PUSH=true ./build.sh

Note: Before pushing an image, make sure to change the release version in the VERSION file.

Tag summary

Content type

Image

Digest

Size

795.2 MB

Last updated

over 4 years ago

docker pull emilioforrer/ci-tools