Updated readme & ci/cd
All checks were successful
Build / Build & Push Dockerfile (push) Successful in 32s
Build / Tag Version (push) Successful in 3s

This commit is contained in:
Zakary Timson 2023-12-13 23:37:54 -05:00
parent d32d9571d2
commit a6e5fa4785
3 changed files with 109 additions and 21 deletions

31
.github/workflows/build.yaml vendored Normal file
View File

@ -0,0 +1,31 @@
name: Build
run-name: Build
on:
push:
jobs:
publish:
name: Build & Push Dockerfile
uses: ztimson/actions/.github/workflows/docker.yaml@develop
with:
name: ztimson/node-exporter
repository: ${{github.server_url}}/${{github.repository}}.git
pass: ${{secrets.DEPLOY_TOKEN}}
tag:
name: Tag Version
needs: publish
runs-on: ubuntu-latest
container: node
steps:
- name: Clone Repository
uses: ztimson/actions/clone@develop
- name: Get Version Number
run: echo "VERSION=$(cat package.json | grep version | grep -Eo ':.+' | grep -Eo '[[:alnum:]\.\/\-]+')" >> $GITHUB_ENV
- name: Tag Version
uses: ztimson/actions/tag@develop
with:
tag: ${{env.VERSION}}

View File

@ -1,16 +0,0 @@
image: docker:latest
stages:
- publish
docker:
stage: publish
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker build --no-cache -t "$CI_REGISTRY_IMAGE:latest" -t ztimson/node-exporter:latest .
- docker push "$CI_REGISTRY_IMAGE:latest"
- docker login -u ztimson -p $DOCKER_TOKEN
- docker push "ztimson/node-exporter:latest"
rules:
- if: $CI_COMMIT_BRANCH

View File

@ -1,12 +1,48 @@
# Node-Exporter
<!-- Header -->
<div id="top" align="center">
<br />
This is a copy of [prom/node-exporter](https://hub.docker.com/r/prom/node-exporter) which also add's the hostname metric.
<!-- Logo -->
<img src="https://git.zakscode.com/repo-avatars/1d5549fafabb98354acb1341d7bb7c14aafb090be3ddb698b55de12a80ecf20f" alt="Logo" width="200" height="200">
## Example
<!-- Title -->
### node-exporter
For the hostname to be detected, you must mount the host's `rootfs` into the container's `/host` directory as seen here:
<!-- Description -->
node-exporter with hostname
```
<!-- Repo badges -->
[![Version](https://img.shields.io/badge/dynamic/json.svg?label=Version&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/node-exporter/tags&query=$[0].name)](https://git.zakscode.com/ztimson/node-exporter/tags)
[![Pull Requests](https://img.shields.io/badge/dynamic/json.svg?label=Pull%20Requests&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/node-exporter&query=open_pr_counter)](https://git.zakscode.com/ztimson/node-exporter/pulls)
[![Issues](https://img.shields.io/badge/dynamic/json.svg?label=Issues&style=for-the-badge&url=https://git.zakscode.com/api/v1/repos/ztimson/node-exporter&query=open_issues_count)](https://git.zakscode.com/ztimson/node-exporter/issues)
<!-- Links -->
---
<div>
<a href="https://git.zakscode.com/ztimson/node-exporter/releases" target="_blank">Release Notes</a>
<a href="https://git.zakscode.com/ztimson/node-exporter/issues/new?template=.github%2fissue_template%2fbug.md" target="_blank">Report a Bug</a>
<a href="https://git.zakscode.com/ztimson/node-exporter/issues/new?template=.github%2fissue_template%2fenhancement.md" target="_blank">Request a Feature</a>
</div>
---
</div>
## Table of Contents
- [node-exporter](#top)
- [About](#about)
- [Built With](#built-with)
- [Setup](#setup)
- [Production](#production)
- [Development](#development)
## About
This is an extension of [prom/node-exporter](https://hub.docker.com/r/prom/node-exporter) which adds the hostname as a metric.
For the hostname to be detected, you must mount the host's `rootfs` into the container's `/host` directory:
```yaml
version: '3.8'
services:
@ -21,3 +57,40 @@ services:
deploy:
mode: global
```
[See on DockerHub](https://hub.docker.com/r/ztimson/node-exporter)
### Built With
[![Docker](https://img.shields.io/badge/Docker-384d54?style=for-the-badge&logo=docker)](https://docker.com/)
## Setup
<details>
<summary>
<h3 id="production" style="display: inline">
Production
</h3>
</summary>
#### Prerequisites
- [Docker](https://docs.docker.com/install/)
#### Instructions
1. Run the docker image: `docker run -v "/:/host:ro,rslave" ztimson/node-exporter --path.rootfs=/host`
</details>
<details>
<summary>
<h3 id="development" style="display: inline">
Development
</h3>
</summary>
#### Prerequisites
- [Docker](https://docs.docker.com/install/)
#### Instructions
1. Build the docker image: `docker build -t MY_IMAGE:TAG .`
2. Run docker image: `docker run -v "/:/host:ro,rslave" MY_IMAGE:TAG --path.rootfs=/host`
</details>