mirror of
https://github.com/grafana/grafana.git
synced 2025-01-27 00:37:04 -06:00
Docker image for ARM
This commit is contained in:
parent
96759e39a6
commit
702d449001
@ -200,47 +200,47 @@ jobs:
|
|||||||
- dist/grafana*
|
- dist/grafana*
|
||||||
|
|
||||||
grafana-docker-master:
|
grafana-docker-master:
|
||||||
docker:
|
machine:
|
||||||
- image: docker:stable-git
|
image: circleci/classic:201808-01
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker info
|
- run: docker info
|
||||||
- run: cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
|
- run: docker run --privileged linuxkit/binfmt:v0.6
|
||||||
|
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
|
||||||
- run: cd packaging/docker && ./build-deploy.sh "master-${CIRCLE_SHA1}"
|
- run: cd packaging/docker && ./build-deploy.sh "master-${CIRCLE_SHA1}"
|
||||||
- run: rm packaging/docker/grafana-latest.linux-x64.tar.gz
|
- run: rm packaging/docker/grafana-latest.linux-*.tar.gz
|
||||||
- run: cp enterprise-dist/grafana-enterprise-*.linux-amd64.tar.gz packaging/docker/grafana-latest.linux-x64.tar.gz
|
- run: cp enterprise-dist/grafana-enterprise-*.linux-amd64.tar.gz packaging/docker/grafana-latest.linux-x64.tar.gz
|
||||||
- run: cd packaging/docker && ./build-enterprise.sh "master"
|
- run: cd packaging/docker && ./build-enterprise.sh "master"
|
||||||
|
|
||||||
|
|
||||||
grafana-docker-pr:
|
grafana-docker-pr:
|
||||||
docker:
|
machine:
|
||||||
- image: docker:stable-git
|
image: circleci/classic:201808-01
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
- setup_remote_docker
|
|
||||||
- run: docker info
|
- run: docker info
|
||||||
- run: cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
|
- run: docker run --privileged linuxkit/binfmt:v0.6
|
||||||
|
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
|
||||||
- run: cd packaging/docker && ./build.sh "${CIRCLE_SHA1}"
|
- run: cd packaging/docker && ./build.sh "${CIRCLE_SHA1}"
|
||||||
|
|
||||||
grafana-docker-release:
|
grafana-docker-release:
|
||||||
docker:
|
machine:
|
||||||
- image: docker:stable-git
|
image: circleci/classic:201808-01
|
||||||
steps:
|
steps:
|
||||||
- checkout
|
- checkout
|
||||||
- attach_workspace:
|
- attach_workspace:
|
||||||
at: .
|
at: .
|
||||||
- setup_remote_docker
|
- run: docker info
|
||||||
- run: docker info
|
- run: docker run --privileged linuxkit/binfmt:v0.6
|
||||||
- run: cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
|
- run: cp dist/grafana-latest.linux-*.tar.gz packaging/docker
|
||||||
- run: cd packaging/docker && ./build-deploy.sh "${CIRCLE_TAG}"
|
- run: cd packaging/docker && ./build-deploy.sh "${CIRCLE_TAG}"
|
||||||
- run: rm packaging/docker/grafana-latest.linux-x64.tar.gz
|
- run: rm packaging/docker/grafana-latest.linux-*.tar.gz
|
||||||
- run: cp enterprise-dist/grafana-enterprise-*.linux-amd64.tar.gz packaging/docker/grafana-latest.linux-x64.tar.gz
|
- run: cp enterprise-dist/grafana-enterprise-*.linux-amd64.tar.gz packaging/docker/grafana-latest.linux-x64.tar.gz
|
||||||
- run: cd packaging/docker && ./build-enterprise.sh "${CIRCLE_TAG}"
|
- run: cd packaging/docker && ./build-enterprise.sh "${CIRCLE_TAG}"
|
||||||
|
|
||||||
build-enterprise:
|
build-enterprise:
|
||||||
docker:
|
docker:
|
||||||
|
2
build.go
2
build.go
@ -164,6 +164,8 @@ func makeLatestDistCopies() {
|
|||||||
"_amd64.deb": "dist/grafana_latest_amd64.deb",
|
"_amd64.deb": "dist/grafana_latest_amd64.deb",
|
||||||
".x86_64.rpm": "dist/grafana-latest-1.x86_64.rpm",
|
".x86_64.rpm": "dist/grafana-latest-1.x86_64.rpm",
|
||||||
".linux-amd64.tar.gz": "dist/grafana-latest.linux-x64.tar.gz",
|
".linux-amd64.tar.gz": "dist/grafana-latest.linux-x64.tar.gz",
|
||||||
|
".linux-armv7.tar.gz": "dist/grafana-latest.linux-armv7.tar.gz",
|
||||||
|
".linux-arm64.tar.gz": "dist/grafana-latest.linux-arm64.tar.gz",
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, file := range files {
|
for _, file := range files {
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
FROM debian:stretch-slim
|
ARG BASE_IMAGE=debian:stretch-slim
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
ARG GRAFANA_TGZ="grafana-latest.linux-x64.tar.gz"
|
ARG GRAFANA_TGZ="grafana-latest.linux-x64.tar.gz"
|
||||||
|
|
||||||
@ -10,7 +11,8 @@ COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz
|
|||||||
|
|
||||||
RUN mkdir /tmp/grafana && tar xfvz /tmp/grafana.tar.gz --strip-components=1 -C /tmp/grafana
|
RUN mkdir /tmp/grafana && tar xfvz /tmp/grafana.tar.gz --strip-components=1 -C /tmp/grafana
|
||||||
|
|
||||||
FROM debian:stretch-slim
|
ARG BASE_IMAGE=debian:stretch-slim
|
||||||
|
FROM ${BASE_IMAGE}
|
||||||
|
|
||||||
ARG GF_UID="472"
|
ARG GF_UID="472"
|
||||||
ARG GF_GID="472"
|
ARG GF_GID="472"
|
||||||
|
@ -1,25 +1,49 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
_grafana_tag=$1
|
_grafana_tag=${1:-}
|
||||||
|
_docker_repo=${2:-grafana/grafana}
|
||||||
|
|
||||||
# If the tag starts with v, treat this as a official release
|
# If the tag starts with v, treat this as a official release
|
||||||
if echo "$_grafana_tag" | grep -q "^v"; then
|
if echo "$_grafana_tag" | grep -q "^v"; then
|
||||||
_grafana_version=$(echo "${_grafana_tag}" | cut -d "v" -f 2)
|
_grafana_version=$(echo "${_grafana_tag}" | cut -d "v" -f 2)
|
||||||
_docker_repo=${2:-grafana/grafana}
|
|
||||||
else
|
else
|
||||||
_grafana_version=$_grafana_tag
|
_grafana_version=$_grafana_tag
|
||||||
_docker_repo=${2:-grafana/grafana-dev}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Building ${_docker_repo}:${_grafana_version}"
|
echo "Building ${_docker_repo}:${_grafana_version}"
|
||||||
|
|
||||||
docker build \
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
--tag "${_docker_repo}:${_grafana_version}" \
|
|
||||||
--no-cache=true .
|
# Build grafana image for a specific arch
|
||||||
|
docker_build () {
|
||||||
|
base_image=$1
|
||||||
|
grafana_tgz=$2
|
||||||
|
tag=$3
|
||||||
|
|
||||||
|
docker build \
|
||||||
|
--build-arg BASE_IMAGE=${base_image} \
|
||||||
|
--build-arg GRAFANA_TGZ=${grafana_tgz} \
|
||||||
|
--tag "${tag}" \
|
||||||
|
--no-cache=true .
|
||||||
|
}
|
||||||
|
|
||||||
|
# Tag docker images of all architectures
|
||||||
|
docker_tag_all () {
|
||||||
|
repo=$1
|
||||||
|
tag=$2
|
||||||
|
docker tag "${_docker_repo}:${_grafana_version}" "${repo}:${tag}"
|
||||||
|
docker tag "${_docker_repo}-arm32v7-linux:${_grafana_version}" "${repo}-arm32v7-linux:${tag}"
|
||||||
|
docker tag "${_docker_repo}-arm64v8-linux:${_grafana_version}" "${repo}-arm64v8-linux:${tag}"
|
||||||
|
}
|
||||||
|
|
||||||
|
docker_build "debian:stretch-slim" "grafana-latest.linux-x64.tar.gz" "${_docker_repo}:${_grafana_version}"
|
||||||
|
docker_build "arm32v7/debian:stretch-slim" "grafana-latest.linux-armv7.tar.gz" "${_docker_repo}-arm32v7-linux:${_grafana_version}"
|
||||||
|
docker_build "arm64v8/debian:stretch-slim" "grafana-latest.linux-arm64.tar.gz" "${_docker_repo}-arm64v8-linux:${_grafana_version}"
|
||||||
|
|
||||||
# Tag as 'latest' for official release; otherwise tag as grafana/grafana:master
|
# Tag as 'latest' for official release; otherwise tag as grafana/grafana:master
|
||||||
if echo "$_grafana_tag" | grep -q "^v"; then
|
if echo "$_grafana_tag" | grep -q "^v"; then
|
||||||
docker tag "${_docker_repo}:${_grafana_version}" "${_docker_repo}:latest"
|
docker_tag_all "${_docker_repo}" "latest"
|
||||||
else
|
else
|
||||||
docker tag "${_docker_repo}:${_grafana_version}" "grafana/grafana:master"
|
docker_tag_all "${_docker_repo}" "master"
|
||||||
|
docker tag "${_docker_repo}:${_grafana_version} grafana/grafana-dev:${_grafana_version}"
|
||||||
fi
|
fi
|
||||||
|
@ -1,24 +1,46 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
_grafana_tag=$1
|
_grafana_tag=${1:-}
|
||||||
|
_docker_repo=${2:-grafana/grafana}
|
||||||
|
|
||||||
# If the tag starts with v, treat this as a official release
|
# If the tag starts with v, treat this as a official release
|
||||||
if echo "$_grafana_tag" | grep -q "^v"; then
|
if echo "$_grafana_tag" | grep -q "^v"; then
|
||||||
_grafana_version=$(echo "${_grafana_tag}" | cut -d "v" -f 2)
|
_grafana_version=$(echo "${_grafana_tag}" | cut -d "v" -f 2)
|
||||||
_docker_repo=${2:-grafana/grafana}
|
|
||||||
else
|
else
|
||||||
_grafana_version=$_grafana_tag
|
_grafana_version=$_grafana_tag
|
||||||
_docker_repo=${2:-grafana/grafana-dev}
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
export DOCKER_CLI_EXPERIMENTAL=enabled
|
||||||
|
|
||||||
echo "pushing ${_docker_repo}:${_grafana_version}"
|
echo "pushing ${_docker_repo}:${_grafana_version}"
|
||||||
docker push "${_docker_repo}:${_grafana_version}"
|
|
||||||
|
|
||||||
|
docker_push_all () {
|
||||||
|
repo=$1
|
||||||
|
tag=$2
|
||||||
|
|
||||||
|
# Push each image individually
|
||||||
|
docker push "${repo}:${tag}"
|
||||||
|
docker push "${repo}-arm32v7-linux:${tag}"
|
||||||
|
docker push "${repo}-arm64v8-linux:${tag}"
|
||||||
|
|
||||||
|
# Create and push a multi-arch manifest
|
||||||
|
docker manifest create "${repo}:${tag}" \
|
||||||
|
"${repo}:${tag}" \
|
||||||
|
"${repo}-arm32v7-linux:${tag}" \
|
||||||
|
"${repo}-arm64v8-linux:${tag}"
|
||||||
|
|
||||||
|
docker manifest push "${repo}:${tag}"
|
||||||
|
}
|
||||||
|
|
||||||
if echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -vq "beta"; then
|
if echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -vq "beta"; then
|
||||||
echo "pushing ${_docker_repo}:latest"
|
echo "pushing ${_docker_repo}:latest"
|
||||||
docker push "${_docker_repo}:latest"
|
docker_push_all "${_docker_repo}" "latest"
|
||||||
|
docker_push_all "${_docker_repo}" "${_grafana_version}"
|
||||||
|
elif echo "$_grafana_tag" | grep -q "^v" && echo "$_grafana_tag" | grep -q "beta"; then
|
||||||
|
docker_push_all "${_docker_repo}" "${_grafana_version}"
|
||||||
elif echo "$_grafana_tag" | grep -q "master"; then
|
elif echo "$_grafana_tag" | grep -q "master"; then
|
||||||
echo "pushing grafana/grafana:master"
|
docker_push_all "grafana/grafana" "master"
|
||||||
docker push grafana/grafana:master
|
docker push "grafana/grafana-dev:${_grafana_version}"
|
||||||
fi
|
fi
|
||||||
|
@ -8,6 +8,8 @@ set -e
|
|||||||
|
|
||||||
EXTRA_OPTS="$@"
|
EXTRA_OPTS="$@"
|
||||||
|
|
||||||
|
CCARMV7=arm-linux-gnueabihf-gcc
|
||||||
|
CCARM64=aarch64-linux-gnu-gcc
|
||||||
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
|
CCX64=/tmp/x86_64-centos6-linux-gnu/bin/x86_64-centos6-linux-gnu-gcc
|
||||||
|
|
||||||
GOPATH=/go
|
GOPATH=/go
|
||||||
@ -26,6 +28,9 @@ fi
|
|||||||
|
|
||||||
echo "Build arguments: $OPT"
|
echo "Build arguments: $OPT"
|
||||||
|
|
||||||
|
go run build.go -goarch armv7 -cc ${CCARMV7} ${OPT} build
|
||||||
|
go run build.go -goarch arm64 -cc ${CCARM64} ${OPT} build
|
||||||
|
|
||||||
CC=${CCX64} go run build.go ${OPT} build
|
CC=${CCX64} go run build.go ${OPT} build
|
||||||
|
|
||||||
yarn install --pure-lockfile --no-progress
|
yarn install --pure-lockfile --no-progress
|
||||||
@ -44,3 +49,5 @@ source /etc/profile.d/rvm.sh
|
|||||||
|
|
||||||
echo "Packaging"
|
echo "Packaging"
|
||||||
go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest
|
go run build.go -goos linux -pkg-arch amd64 ${OPT} package-only latest
|
||||||
|
go run build.go -goos linux -pkg-arch armv7 ${OPT} package-only latest
|
||||||
|
go run build.go -goos linux -pkg-arch arm64 ${OPT} package-only latest
|
||||||
|
Loading…
Reference in New Issue
Block a user