Commit edd013ab authored by Alex Thomae's avatar Alex Thomae

Merge branch 'add-docker-hub' into 'master'

Adds docker hub image

* refactoring of the build pipeline
* adds more information in README
* adds local `.pylintrc`

See merge request !5
parents dcfd85fd 7cfa59c5
Pipeline #78929669 passed with stages
in 4 minutes and 50 seconds
variables:
DOCKER_DRIVER: overlay2
PORT: 9308
DOCKERHUB_REPO_PREFIX: ixdotai
DOCKERHUB_REPO_NAME: stellar-exporter
stages:
- lint
- build
- release
.tags-template: &tags-definition
tags:
......@@ -16,33 +19,57 @@ stages:
entrypoint: [""]
stage: build
script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile --build-arg PORT=${PORT} --destination ${IMAGE_TAG}
- echo "Building with PORT=${PORT}"
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"},\"index.docker.io\":{\"auth\":\"${DOCKERHUB_REGISTRY_AUTH}\"}}}" > /kaniko/.docker/config.json
- /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile --build-arg PORT=${PORT} ${DESTINATION}
pylint:
image: python:latest
stage: lint
script:
- curl -o .pylintrc https://tool.ix.ai/.pylintrc
- pip install pylint pygelf prometheus_client stellar-base mnemonic toml
- pylint --rcfile=.pylintrc src/*.py
<<: *tags-definition
build:test:
build:dev:
except:
- master
- latest
- tags
before_script:
- export IMAGE_TAG="${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:dev-${CI_COMMIT_REF_NAME}"
<<: *tags-definition
<<: *build-definition
build:release:
build:tags:
only:
- master
except:
- latest
- tags
before_script:
- export IMAGE_TAG="${CI_REGISTRY_IMAGE}:latest"
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:${CI_COMMIT_REF_NAME}"
<<: *tags-definition
<<: *build-definition
publish:release:
<<: *tags-definition
stage: release
only:
- tags
before_script:
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:latest --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:latest"
image:
name: gcr.io/kaniko-project/executor:debug
entrypoint: [""]
script:
- echo "{\"auths\":{\"${CI_REGISTRY}\":{\"username\":\"${CI_REGISTRY_USER}\",\"password\":\"${CI_REGISTRY_PASSWORD}\"},\"index.docker.io\":{\"auth\":\"${DOCKERHUB_REGISTRY_AUTH}\"}}}" > /kaniko/.docker/config.json
- echo "FROM ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}" | /kaniko/executor --dockerfile /dev/stdin ${DESTINATION}
publish:readme:
stage: release
variables:
README_PATH: ${CI_PROJECT_DIR}/README.md
only:
- master
image:
name: sheogorath/readme-to-dockerhub:latest
entrypoint: ['']
script:
- node /app/index.js
<<: *tags-definition
This diff is collapsed.
FROM registry.gitlab.com/ix.ai/alpine:latest
LABEL MAINTAINER="docker@ix.ai"
FROM alpine:latest
LABEL maintainer="docker@ix.ai"
ARG PORT=9308
ARG LOGLEVEL=INFO
RUN apk add --no-cache python3-dev &&\
pip3 install --no-cache-dir stellar-base mnemonic toml
RUN apk --no-cache upgrade && \
apk add --no-cache python3-dev gcc musl-dev && \
pip3 install --no-cache-dir stellar-base mnemonic toml prometheus_client pygelf
ENV LOGLEVEL=INFO PORT=${PORT}
ENV LOGLEVEL=${LOGLEVEL} PORT=${PORT}
COPY src/stellar-exporter.py /
......
# stellar-exporter
[![Pipeline Status](https://gitlab.com/ix.ai/stellar-exporter/badges/master/pipeline.svg)](https://gitlab.com/ix.ai/stellar-exporter/)
[![Docker Stars](https://img.shields.io/docker/stars/ixdotai/stellar-exporter.svg)](https://hub.docker.com/r/ixdotai/stellar-exporter/)
[![Docker Pulls](https://img.shields.io/docker/pulls/ixdotai/stellar-exporter.svg)](https://hub.docker.com/r/ixdotai/stellar-exporter/)
[![Gitlab Project](https://img.shields.io/badge/GitLab-Project-554488.svg)](https://gitlab.com/ix.ai/stellar-exporter/)
A [Prometheus](https://prometheus.io) exporter for [Stellar](https://www.stellar.org/) written in python
## Usage
......@@ -17,3 +22,9 @@ docker run --rm -it -p 9308:9308 \
* `GELF_PORT` (defaults to `12201`) - the port to use for GELF logging
* `PORT` (defaults to `9308`) - the listen port for the exporter
* `LOGLEVEL` (defaults to `INFO`)
## Resources:
* GitLab: https://gitlab.com/ix.ai/stellar-exporter
* Docker Hub: https://hub.docker.com/r/ixdotai/stellar-exporter
See also [ix.ai/crypto-exporter](https://gitlab.com/ix.ai/crypto-exporter) for more usage examples, including Prometheus configuration
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment