mirror of
https://github.com/logos-storage/dist-tests-prometheus.git
synced 2026-01-02 13:13:07 +00:00
Add Docker autobuilds
This commit is contained in:
commit
f97d7fdce6
122
.github/workflows/docker.yml
vendored
Normal file
122
.github/workflows/docker.yml
vendored
Normal file
@ -0,0 +1,122 @@
|
|||||||
|
name: Docker
|
||||||
|
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
tags:
|
||||||
|
- 'v*.*.*'
|
||||||
|
paths-ignore:
|
||||||
|
- '**/*.md'
|
||||||
|
- docker-compose.yaml
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCKER_FILE: Dockerfile
|
||||||
|
DOCKER_REPO: codexstorage/dist-tests-prometheus
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
# Build platform specific image
|
||||||
|
build:
|
||||||
|
strategy:
|
||||||
|
fail-fast: true
|
||||||
|
matrix:
|
||||||
|
target:
|
||||||
|
- os: linux
|
||||||
|
arch: amd64
|
||||||
|
- os: linux
|
||||||
|
arch: arm64
|
||||||
|
include:
|
||||||
|
- target:
|
||||||
|
os: linux
|
||||||
|
arch: amd64
|
||||||
|
builder: ubuntu-22.04
|
||||||
|
- target:
|
||||||
|
os: linux
|
||||||
|
arch: arm64
|
||||||
|
builder: buildjet-4vcpu-ubuntu-2204-arm
|
||||||
|
|
||||||
|
name: Build ${{ matrix.target.os }}/${{ matrix.target.arch }}
|
||||||
|
runs-on: ${{ matrix.builder }}
|
||||||
|
outputs:
|
||||||
|
tags-linux-amd64: ${{ steps.tags.outputs.tags-linux-amd64 }}
|
||||||
|
tags-linux-arm64: ${{ steps.tags.outputs.tags-linux-arm64 }}
|
||||||
|
env:
|
||||||
|
PLATFORM: ${{ format('{0}/{1}', 'linux', matrix.target.arch) }}
|
||||||
|
SUFFIX: ${{ format('{0}-{1}', 'linux', matrix.target.arch) }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Docker - Meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ${{ env.DOCKER_REPO }}
|
||||||
|
flavor: |
|
||||||
|
latest=false
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}},suffix=-${{ env.SUFFIX }}
|
||||||
|
type=sha,suffix=-${{ env.SUFFIX }},enable=${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
|
- name: Docker - Set tags output
|
||||||
|
id: tags
|
||||||
|
run: |
|
||||||
|
if [[ '${{ matrix.target.os }}' == 'linux' && '${{ matrix.target.arch }}' == 'amd64' ]]; then
|
||||||
|
echo "tags-linux-amd64=${{ steps.meta.outputs.tags }}" >> "$GITHUB_OUTPUT"
|
||||||
|
elif [[ '${{ matrix.target.os }}' == 'linux' && '${{ matrix.target.arch }}' == 'arm64' ]]; then
|
||||||
|
echo "tags-linux-arm64=${{ steps.meta.outputs.tags }}" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Docker - Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker - Build and Push
|
||||||
|
uses: docker/build-push-action@v4
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
file: ${{ env.DOCKER_FILE }}
|
||||||
|
platforms: ${{ env.PLATFORM }}
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
|
||||||
|
# Publish single image
|
||||||
|
publish:
|
||||||
|
name: Push single image
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: build
|
||||||
|
steps:
|
||||||
|
- name: Docker - Meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v4
|
||||||
|
with:
|
||||||
|
images: ${{ env.DOCKER_REPO }}
|
||||||
|
tags: |
|
||||||
|
type=semver,pattern={{version}}
|
||||||
|
type=sha,enable=${{ !startsWith(github.ref, 'refs/tags/') }}
|
||||||
|
|
||||||
|
- name: Docker - Set tags
|
||||||
|
run: |
|
||||||
|
# Transform multi-line tags in to the comma-seperated
|
||||||
|
TAGS=$(echo "${{ steps.meta.outputs.tags }}" | tr '\n' ',' | awk '{gsub(/,$/,"");}1')
|
||||||
|
echo "TAGS=${TAGS}" >>$GITHUB_ENV
|
||||||
|
|
||||||
|
- name: Docker - Login to Docker Hub
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Docker - Create and push manifest images
|
||||||
|
uses: Noelware/docker-manifest-action@master
|
||||||
|
with:
|
||||||
|
inputs: ${{ env.TAGS }}
|
||||||
|
images: ${{ needs.build.outputs.tags-linux-amd64 }},${{ needs.build.outputs.tags-linux-arm64 }}
|
||||||
|
push: true
|
||||||
6
Dockerfile
Normal file
6
Dockerfile
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
FROM prom/prometheus:v2.43.0
|
||||||
|
|
||||||
|
COPY --chmod=0755 docker-entrypoint.sh /
|
||||||
|
|
||||||
|
ENTRYPOINT ["/usr/bin/env"]
|
||||||
|
CMD ["sh", "/docker-entrypoint.sh"]
|
||||||
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
# Prometheus for Codex Distributed Testing
|
||||||
|
|
||||||
|
Prometheus docker image that allows you to set the prometheus.yml configuration file from a base64 encoded environment variable.
|
||||||
|
Very simple, really.
|
||||||
10
docker-compose.yaml
Normal file
10
docker-compose.yaml
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
services:
|
||||||
|
prometheus-envconf:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
ports:
|
||||||
|
- 9000:9092
|
||||||
|
environment:
|
||||||
|
- PROM_PORT=9092
|
||||||
|
- PROM_CONFIG=Z2xvYmFsOgogIHNjcmFwZV9pbnRlcnZhbDogMzBzCiAgc2NyYXBlX3RpbWVvdXQ6IDEwcwoKc2NyYXBlX2NvbmZpZ3M6CiAgLSBqb2JfbmFtZTogc2VydmljZXMKICAgIG1ldHJpY3NfcGF0aDogL21ldHJpY3MKICAgIHN0YXRpY19jb25maWdzOgogICAgICAtIHRhcmdldHM6CiAgICAgICAgICAtICdwcm9tZXRoZXVzOjkwOTAnCiAgICAgICAgICAtICdjb2RleC1ub2RlMTo5MDkwJwogICAgICAgICAgLSAnY29kZXgtbm9kZTI6OTA5MScKICAgICAgICAgIC0gJ2NvZGV4LW5vZGUzOjkwOTInCg==
|
||||||
11
docker-entrypoint.sh
Normal file
11
docker-entrypoint.sh
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
echo "Decoding config..."
|
||||||
|
|
||||||
|
echo $PROM_CONFIG > encoded.b64
|
||||||
|
|
||||||
|
base64 -d encoded.b64 > /etc/prometheus/prometheus.yml
|
||||||
|
|
||||||
|
cat /etc/prometheus/prometheus.yml
|
||||||
|
|
||||||
|
echo "Starting prometheus..."
|
||||||
|
|
||||||
|
/bin/prometheus --web.listen-address="0.0.0.0:$PROM_PORT" --web.enable-lifecycle --config.file=/etc/prometheus/prometheus.yml
|
||||||
Loading…
x
Reference in New Issue
Block a user