make upstream repo configurable

This commit is contained in:
fix 2021-03-02 21:57:42 +01:00
parent 6db0a7e992
commit cf605f3d29
3 changed files with 7 additions and 2 deletions

View File

@ -1,2 +1,3 @@
PROMETHEUS_CONFIG_FILE_PATH=/path/to/prometheus/config/prometheus.yaml
PROMETHEUS_DATA_PATH=/path/to/prometheus/data
PROMETHEUS_REPO='https://github.com/prometheus/prometheus.git'

View File

@ -3,7 +3,7 @@ ARG GO_VERSION=alpine
FROM golang:${GO_VERSION} as build
ARG PROMETHEUS_VERSION=
ARG PROMETHEUS_REPO="https://github.com/prometheus/prometheus.git"
ARG PROMETHEUS_REPO
RUN \
apk update --no-cache &&\
@ -15,6 +15,7 @@ RUN \
yarn && \
git config --global advice.detachedHead false
RUN \
echo "selected repo: ${PROMETHEUS_REPO}" && \
if [ -z "${PROMETHEUS_VERSION}" ]; then \
PROMETHEUS_VERSION=$( \
git ls-remote "${PROMETHEUS_REPO}" | \
@ -26,7 +27,8 @@ RUN \
git clone \
--branch="${PROMETHEUS_VERSION}" \
--depth=1 \
"${PROMETHEUS_REPO}" && \
"${PROMETHEUS_REPO}" \
prometheus && \
cd prometheus && \
CGO_ENABLED=0 make build

View File

@ -4,6 +4,8 @@ services:
prometheus:
build:
context: ./
args:
- PROMETHEUS_REPO=${PROMETHEUS_REPO}
container_name: prometheus
image: prometheus:local
logging: