...
 
Commits (2)
  • Alex Thomae's avatar
    Redesigns the build process · 84e9553b
    Alex Thomae authored
    * adds `requirements.txt`
    * makes the individual jobs more readable
    * tags commits on master with `dev-master` in the docker registries
    * adds environment to the git tags that are published
    84e9553b
  • Alex Thomae's avatar
    Merge branch 'patch-1' into 'master' · 75a74fc8
    Alex Thomae authored
    Redesigns the build process
    
    * adds `requirements.txt`
    * makes the individual jobs more readable
    * tags commits on master with `dev-master` in the docker registries
    * adds environment to the git tags that are published
    
    See merge request !10
    75a74fc8
......@@ -7,7 +7,7 @@ variables:
stages:
- lint
- build
- release
- publish
.tags-template: &tags-definition
tags:
......@@ -19,45 +19,46 @@ stages:
entrypoint: [""]
stage: build
script:
- 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
- echo "/kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile ${DESTINATION}"
- /kaniko/executor --context ${CI_PROJECT_DIR} --dockerfile ${CI_PROJECT_DIR}/Dockerfile --build-arg PORT=${PORT} ${DESTINATION}
pylint:
image: python:latest
stage: lint
script:
- pip install prometheus_client pylint coinbase pygelf
- pip install -r ${CI_PROJECT_DIR}/src/requirements.txt
- pip install pylint
- pylint --rcfile=.pylintrc src/*.py
<<: *tags-definition
build:dev:
except:
- master
- tags
before_script:
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:dev-${CI_COMMIT_REF_NAME}"
<<: *tags-definition
<<: *build-definition
build:tags:
only:
- tags
- master
before_script:
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME} --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:${CI_COMMIT_REF_NAME}"
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:dev-${CI_COMMIT_REF_NAME}"
- export DESTINATION="${DESTINATION} --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:dev-${CI_COMMIT_REF_NAME}"
publish:release:
<<: *tags-definition
<<: *build-definition
build:release:
stage: publish
environment:
name: production
url: https://hub.docker.com/r/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}
only:
- master
- tags
before_script:
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:latest --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:latest"
<<: *tags-definition
<<: *build-definition
- export DESTINATION="--destination ${CI_REGISTRY_IMAGE}:${CI_COMMIT_REF_NAME}"
- export DESTINATION="${DESTINATION} --destination ${CI_REGISTRY_IMAGE}:latest"
- export DESTINATION="${DESTINATION} --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:${CI_COMMIT_REF_NAME}"
- export DESTINATION="${DESTINATION} --destination=index.docker.io/${DOCKERHUB_REPO_PREFIX}/${DOCKERHUB_REPO_NAME}:latest"
publish:readme:
stage: release
<<: *tags-definition
stage: publish
variables:
README_PATH: ${CI_PROJECT_DIR}/README.md
only:
......@@ -67,4 +68,3 @@ publish:readme:
entrypoint: ['']
script:
- node /app/index.js
<<: *tags-definition
......@@ -5,14 +5,16 @@ ARG PORT=9308
ARG LOGLEVEL=INFO
ARG FIAT=EUR
WORKDIR /app
COPY src/ /app
RUN apk --no-cache upgrade && \
apk --no-cache add python3 gcc musl-dev && \
pip3 install --no-cache-dir prometheus_client pygelf coinbase
pip3 install --no-cache-dir -r requirements.txt
ENV LOGLEVEL=${LOGLEVEL} FIAT=${FIAT} PORT=${PORT}
COPY src/coinbase-exporter.py /
EXPOSE ${PORT}
ENTRYPOINT ["python3", "/coinbase-exporter.py"]
ENTRYPOINT ["python3", "/app/coinbase-exporter.py"]
prometheus_client
coinbase
pygelf