Skip to content

Commit baae6a1

Browse files
authored
chore: Status badges in README (#761)
* convert readme to markdown * auto generate badges the table for pasting into the readme * add script to auto update the badges in the readme * resolve lint warnings * add bash strict mode to badge update script * fix readme link
1 parent ab6192e commit baae6a1

File tree

3 files changed

+227
-76
lines changed

3 files changed

+227
-76
lines changed

README.adoc

Lines changed: 0 additions & 76 deletions
This file was deleted.

README.md

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# Stackable Docker Images
2+
3+
This repository contains Dockerfiles and scripts to build base images for use within Stackable.
4+
5+
<!-- start:badges: autogenerated by ./update_readme_badges.sh -->
6+
| | | | |
7+
| -: | -: | -: | -: |
8+
| [![Build Airflow]][dev_airflow.yaml] | [![Build Druid]][dev_druid.yaml] | [![Build Hadoop]][dev_hadoop.yaml] | [![Build HBase]][dev_hbase.yaml] |
9+
| [![Build Hello-World]][dev_hello-world.yaml] | [![Build Hive]][dev_hive.yaml] | [![Build Java Base]][dev_java-base.yaml] | [![Build Java Development]][dev_java-devel.yaml] |
10+
| [![Build Kafka Testing Tools]][dev_kafka-testing-tools.yaml] | [![Build Kafka]][dev_kafka.yaml] | [![Build kcat]][dev_kcat.yaml] | [![Build Krb5]][dev_krb5.yaml] |
11+
| [![Build NiFi]][dev_nifi.yaml] | [![Build Omid]][dev_omid.yaml] | [![Build OPA]][dev_opa.yaml] | [![Build Spark K8s]][dev_spark-k8s.yaml] |
12+
| [![Build Stackable Base]][dev_stackable-base.yaml] | [![Build Superset]][dev_superset.yaml] | [![Build Testing Tools]][dev_testing-tools.yaml] | [![Build Tools]][dev_tools.yaml] |
13+
| [![Build Trino CLI]][dev_trino-cli.yaml] | [![Build Trino]][dev_trino.yaml] | [![Build Vector]][dev_vector.yaml] | [![Build ZooKeeper]][dev_zookeeper.yaml] |
14+
<!-- end:badges -->
15+
16+
## Prerequisites
17+
18+
* [Stackable Image Tools](https://github.com/stackabletech/image-tools) (`pip install image-tools-stackabletech`)
19+
* Docker including the [`buildx` plugin](https://github.com/docker/buildx)
20+
* Optional: [OpenShift preflight tool](https://github.com/redhat-openshift-ecosystem/openshift-preflight) to verify an image for OpenShift
21+
22+
## Build Product Images
23+
24+
Product images are published to the `docker.stackable.tech` registry under the `stackable` organization by default.
25+
26+
### Build single products locally
27+
28+
To build and push product images to the default repository use this command:
29+
30+
```sh
31+
bake --product zookeeper --image 0.0.0-dev --push
32+
```
33+
34+
This will build images for Apache ZooKeeper versions as defined in the `conf.py` file, tag them with the `image-version` 0.0.0-dev and push them to the registry.
35+
36+
You can select a specific version of a product to build using the syntax `product=version` e.g. to build Hive 3.1.3 you can use this command:
37+
38+
```sh
39+
bake --product hive=3.1.3 -i 0.0.0-dev
40+
```
41+
42+
> [!NOTE]
43+
> `-i` is the shorthand for `--image` (i.e. the resulting image tag)
44+
45+
### Build all products locally
46+
47+
To build all products in all versions locally you can use this command
48+
49+
```sh
50+
bake --image-version 0.0.0-dev
51+
```
52+
53+
### Build everything in GitHub
54+
55+
The GitHub action called `Build (and optionally publish) 0.0.0-dev images` can be triggered manually to do build all images in all versions.
56+
When triggered manually it will _not_ push the images to the registry.
57+
58+
## Verify Product Images
59+
60+
To verify if Apache Zookeeper validate against OpenShift preflight, run:
61+
62+
```sh
63+
check-container --product zookeeper --image 0.0.0-dev
64+
```
65+
66+
## ubi8-rust-builder / ubi9-rust-builder
67+
68+
These images are meant to be used in multi-stage builds as a base image for projects building Rust projects.
69+
They are automatically rebuilt and pushed every night and also on every push to the main branch, in addition a build can be triggered using GitHub Actions.
70+
71+
The image will run `cargo build --release` in the current context and copy all binaries to an `/app` directory.
72+
73+
This will bake in the current stable Rust version at the time this image was built, which means it should be rebuilt (and tagged) for every release of Rust.
74+
75+
## Example usage
76+
77+
```dockerfile
78+
FROM docker.stackable.tech/ubi9-rust-builder AS builder
79+
80+
FROM registry.access.redhat.com/ubi9/ubi-minimal AS operator
81+
LABEL maintainer="Stackable GmbH"
82+
83+
# Update image
84+
RUN microdnf update \
85+
&& microdnf install \
86+
shadow-utils \
87+
&& rm -rf /var/cache/yum
88+
89+
COPY --from=builder /app/stackable-zookeeper-operator /
90+
91+
RUN groupadd -g 1000 stackable && adduser -u 1000 -g stackable -c 'Stackable Operator' stackable
92+
93+
USER 1000:1000
94+
95+
ENTRYPOINT ["/stackable-zookeeper-operator"]
96+
```
97+
98+
<!-- start:links: autogenerated by ./update_readme_badges.sh -->
99+
[Build Airflow]: https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml/badge.svg
100+
[dev_airflow.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml
101+
[Build Druid]: https://github.com/stackabletech/docker-images/actions/workflows/dev_druid.yaml/badge.svg
102+
[dev_druid.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_druid.yaml
103+
[Build Hadoop]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hadoop.yaml/badge.svg
104+
[dev_hadoop.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hadoop.yaml
105+
[Build HBase]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hbase.yaml/badge.svg
106+
[dev_hbase.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hbase.yaml
107+
[Build Hello-World]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hello-world.yaml/badge.svg
108+
[dev_hello-world.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hello-world.yaml
109+
[Build Hive]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hive.yaml/badge.svg
110+
[dev_hive.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_hive.yaml
111+
[Build Java Base]: https://github.com/stackabletech/docker-images/actions/workflows/dev_java-base.yaml/badge.svg
112+
[dev_java-base.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_java-base.yaml
113+
[Build Java Development]: https://github.com/stackabletech/docker-images/actions/workflows/dev_java-devel.yaml/badge.svg
114+
[dev_java-devel.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_java-devel.yaml
115+
[Build Kafka Testing Tools]: https://github.com/stackabletech/docker-images/actions/workflows/dev_kafka-testing-tools.yaml/badge.svg
116+
[dev_kafka-testing-tools.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_kafka-testing-tools.yaml
117+
[Build Kafka]: https://github.com/stackabletech/docker-images/actions/workflows/dev_kafka.yaml/badge.svg
118+
[dev_kafka.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_kafka.yaml
119+
[Build kcat]: https://github.com/stackabletech/docker-images/actions/workflows/dev_kcat.yaml/badge.svg
120+
[dev_kcat.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_kcat.yaml
121+
[Build Krb5]: https://github.com/stackabletech/docker-images/actions/workflows/dev_krb5.yaml/badge.svg
122+
[dev_krb5.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_krb5.yaml
123+
[Build NiFi]: https://github.com/stackabletech/docker-images/actions/workflows/dev_nifi.yaml/badge.svg
124+
[dev_nifi.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_nifi.yaml
125+
[Build Omid]: https://github.com/stackabletech/docker-images/actions/workflows/dev_omid.yaml/badge.svg
126+
[dev_omid.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_omid.yaml
127+
[Build OPA]: https://github.com/stackabletech/docker-images/actions/workflows/dev_opa.yaml/badge.svg
128+
[dev_opa.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_opa.yaml
129+
[Build Spark K8s]: https://github.com/stackabletech/docker-images/actions/workflows/dev_spark-k8s.yaml/badge.svg
130+
[dev_spark-k8s.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_spark-k8s.yaml
131+
[Build Stackable Base]: https://github.com/stackabletech/docker-images/actions/workflows/dev_stackable-base.yaml/badge.svg
132+
[dev_stackable-base.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_stackable-base.yaml
133+
[Build Superset]: https://github.com/stackabletech/docker-images/actions/workflows/dev_superset.yaml/badge.svg
134+
[dev_superset.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_superset.yaml
135+
[Build Testing Tools]: https://github.com/stackabletech/docker-images/actions/workflows/dev_testing-tools.yaml/badge.svg
136+
[dev_testing-tools.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_testing-tools.yaml
137+
[Build Tools]: https://github.com/stackabletech/docker-images/actions/workflows/dev_tools.yaml/badge.svg
138+
[dev_tools.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_tools.yaml
139+
[Build Trino CLI]: https://github.com/stackabletech/docker-images/actions/workflows/dev_trino-cli.yaml/badge.svg
140+
[dev_trino-cli.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_trino-cli.yaml
141+
[Build Trino]: https://github.com/stackabletech/docker-images/actions/workflows/dev_trino.yaml/badge.svg
142+
[dev_trino.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_trino.yaml
143+
[Build Vector]: https://github.com/stackabletech/docker-images/actions/workflows/dev_vector.yaml/badge.svg
144+
[dev_vector.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_vector.yaml
145+
[Build ZooKeeper]: https://github.com/stackabletech/docker-images/actions/workflows/dev_zookeeper.yaml/badge.svg
146+
[dev_zookeeper.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_zookeeper.yaml
147+
<!-- end:links -->

update_readme_badges.sh

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#!/usr/bin/env bash
2+
# shellcheck disable=SC2129
3+
# Run this to auto-update the badges table in the readme
4+
5+
set -euo pipefail
6+
7+
AUTO_GENERATED_COMMENT="autogenerated by $0"
8+
GITHUB_ACTION_URL_PREFIX="https://github.com/stackabletech/docker-images/actions/workflows"
9+
COLS=4
10+
11+
# https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml/badge.svg
12+
# https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml
13+
14+
# [![Build Airflow](https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml/badge.svg)](https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml)
15+
16+
LINK_SHORTCUTS=()
17+
CURRENT_COLUMN=-1
18+
19+
BADGES_TMP=$(mktemp)
20+
LINKS_TMP=$(mktemp)
21+
22+
echo "<!-- start:badges: $AUTO_GENERATED_COMMENT -->" >> "$BADGES_TMP"
23+
24+
# Print the empty headings
25+
for _ in $(seq 0 $((COLS - 1))); do
26+
echo -n "| " >> "$BADGES_TMP"
27+
done
28+
echo "|" >> "$BADGES_TMP"
29+
30+
# Print the heading separator and alignments
31+
for _ in $(seq 0 $((COLS - 1))); do
32+
echo -n "| -: " >> "$BADGES_TMP"
33+
done
34+
echo "|" >> "$BADGES_TMP"
35+
36+
for DEV_WORKFLOW_FILE in .github/workflows/dev_*.yaml; do
37+
CURRENT_COLUMN=$(( (CURRENT_COLUMN + 1) % COLS ))
38+
39+
DEV_WORKFLOW_NAME=$(yq -r '.name' "$DEV_WORKFLOW_FILE")
40+
DEV_WORKFLOW_BASENAME=$(basename "$DEV_WORKFLOW_FILE")
41+
DEV_WORKFLOW_WORKFLOW_URL="${GITHUB_ACTION_URL_PREFIX}/${DEV_WORKFLOW_BASENAME}"
42+
DEV_WORKFLOW_BADGE_URL="${DEV_WORKFLOW_WORKFLOW_URL}/badge.svg"
43+
44+
# Append the image and link shortcuts to be printed at the end
45+
LINK_SHORTCUTS+=("[${DEV_WORKFLOW_NAME}]: ${DEV_WORKFLOW_BADGE_URL}")
46+
LINK_SHORTCUTS+=("[${DEV_WORKFLOW_BASENAME}]: ${DEV_WORKFLOW_WORKFLOW_URL}")
47+
48+
# Print the cells which contain the shortcuts to the image and link:
49+
# eg: [![Build Airflow]][dev_airflow.yaml]
50+
echo -n "| [![${DEV_WORKFLOW_NAME}]][${DEV_WORKFLOW_BASENAME}] " >> "$BADGES_TMP"
51+
# Use this for debugging the grid (comment out the echo above):
52+
# echo -n "| x "
53+
54+
# On the last column, cap it off
55+
if [ ${CURRENT_COLUMN} -eq $((COLS - 1)) ]; then
56+
echo -n "|" >> "$BADGES_TMP"
57+
echo >> "$BADGES_TMP"
58+
fi
59+
done
60+
echo -n "<!-- end:badges -->" >> "$BADGES_TMP"
61+
62+
# Print the image and link shortcuts. Eg:
63+
# [Build Airflow]: https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml/badge.svg
64+
# [dev_airflow.yaml]: https://github.com/stackabletech/docker-images/actions/workflows/dev_airflow.yaml
65+
echo "<!-- start:links: $AUTO_GENERATED_COMMENT -->" >> "$LINKS_TMP"
66+
printf '%s\n' "${LINK_SHORTCUTS[@]}" >> "$LINKS_TMP"
67+
echo -n "<!-- end:links -->" >> "$LINKS_TMP"
68+
69+
BADGES_CONTENT=$(sed ':a;N;$!ba;s/\n/\\n/g' "$BADGES_TMP")
70+
LINKS_CONTENT=$(sed ':a;N;$!ba;s/\n/\\n/g' "$LINKS_TMP")
71+
72+
README_TMP=$(mktemp)
73+
74+
awk "/^<!-- start:badges/{flag=1; print \"$BADGES_CONTENT\"} {if(!flag)print} /<!-- end:badges/{flag=0;next}" README.md > "$README_TMP"
75+
cp "$README_TMP" README.md
76+
awk "/^<!-- start:links/{flag=1; print \"$LINKS_CONTENT\"} {if(!flag)print} /<!-- end:links/{flag=0;next}" README.md > "$README_TMP"
77+
cp "$README_TMP" README.md
78+
79+
# cleanup
80+
rm "$BADGES_TMP" "$LINKS_TMP" "$README_TMP"

0 commit comments

Comments
 (0)