-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #93 from zhaixiaojuan/grafana-10.2.2
Add grafana:10.2.2
- Loading branch information
Showing
3 changed files
with
168 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
diff --git a/Dockerfile b/Dockerfile | ||
index fc73ee1..462f8a1 100644 | ||
--- a/Dockerfile | ||
+++ b/Dockerfile | ||
@@ -1,5 +1,3 @@ | ||
-# syntax=docker/dockerfile:1 | ||
- | ||
ARG BASE_IMAGE=alpine:3.18.3 | ||
ARG JS_IMAGE=node:18-alpine3.18 | ||
ARG JS_PLATFORM=linux/amd64 | ||
@@ -10,26 +8,6 @@ ARG JS_SRC=js-builder | ||
|
||
FROM --platform=${JS_PLATFORM} ${JS_IMAGE} as js-builder | ||
|
||
-ENV NODE_OPTIONS=--max_old_space_size=8000 | ||
- | ||
-WORKDIR /tmp/grafana | ||
- | ||
-COPY package.json yarn.lock .yarnrc.yml ./ | ||
-COPY .yarn .yarn | ||
-COPY packages packages | ||
-COPY plugins-bundled plugins-bundled | ||
-COPY public public | ||
- | ||
-RUN yarn install --immutable | ||
- | ||
-COPY tsconfig.json .eslintrc .editorconfig .browserslistrc .prettierrc.js babel.config.json ./ | ||
-COPY public public | ||
-COPY scripts scripts | ||
-COPY emails emails | ||
- | ||
-ENV NODE_ENV production | ||
-RUN yarn build | ||
- | ||
FROM ${GO_IMAGE} as go-builder | ||
|
||
ARG COMMIT_SHA="" | ||
@@ -48,8 +26,8 @@ WORKDIR /tmp/grafana | ||
COPY go.* ./ | ||
COPY .bingo .bingo | ||
|
||
-RUN go mod download | ||
-RUN if [[ "$BINGO" = "true" ]]; then \ | ||
+RUN export GOPROXY=https://goproxy.cn && go mod download | ||
+RUN if [ "$BINGO" = "true" ]; then \ | ||
go install github.com/bwplotka/bingo@latest && \ | ||
bingo get -v; \ | ||
fi | ||
@@ -70,18 +48,18 @@ COPY LICENSE ./ | ||
ENV COMMIT_SHA=${COMMIT_SHA} | ||
ENV BUILD_BRANCH=${BUILD_BRANCH} | ||
|
||
-RUN make build-go GO_BUILD_TAGS=${GO_BUILD_TAGS} WIRE_TAGS=${WIRE_TAGS} | ||
+RUN go get github.com/mattn/go-sqlite3 && make build-go GO_BUILD_TAGS=${GO_BUILD_TAGS} WIRE_TAGS=${WIRE_TAGS} | ||
|
||
-FROM ${BASE_IMAGE} as tgz-builder | ||
+# FROM ${BASE_IMAGE} as tgz-builder | ||
|
||
-WORKDIR /tmp/grafana | ||
+# WORKDIR /tmp/grafana | ||
|
||
-ARG GRAFANA_TGZ="grafana-latest.linux-x64-musl.tar.gz" | ||
+# ARG GRAFANA_TGZ="grafana-latest.linux-x64-musl.tar.gz" | ||
|
||
-COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz | ||
+# COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz | ||
|
||
# add -v to make tar print every file it extracts | ||
-RUN tar x -z -f /tmp/grafana.tar.gz --strip-components=1 | ||
+# RUN tar x -z -f /tmp/grafana.tar.gz --strip-components=1 | ||
|
||
# helpers for COPY --from | ||
FROM ${GO_SRC} as go-src | ||
@@ -166,7 +144,7 @@ RUN if [ ! $(getent group "$GF_GID") ]; then \ | ||
chmod -R 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING" | ||
|
||
COPY --from=go-src /tmp/grafana/bin/grafana* /tmp/grafana/bin/*/grafana* ./bin/ | ||
-COPY --from=js-src /tmp/grafana/public ./public | ||
+COPY --from=js-src $GF_PATHS_HOME/public ./public | ||
COPY --from=go-src /tmp/grafana/LICENSE ./ | ||
|
||
EXPOSE 3000 | ||
diff --git a/Makefile b/Makefile | ||
index 54287b0..c998f84 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -212,25 +212,26 @@ shellcheck: $(SH_FILES) ## Run checks for shell scripts. | ||
##@ Docker | ||
|
||
TAG_SUFFIX=$(if $(WIRE_TAGS)!=oss,-$(WIRE_TAGS)) | ||
-PLATFORM=linux/amd64 | ||
+PLATFORM ?= linux/amd64 | ||
+IMG_NAME ?= grafana/grafana$(TAG_SUFFIX):dev | ||
|
||
build-docker-full: ## Build Docker image for development. | ||
@echo "build docker container" | ||
tar -ch . | \ | ||
- docker buildx build - \ | ||
+ docker build - \ | ||
--platform $(PLATFORM) \ | ||
--build-arg BINGO=false \ | ||
--build-arg GO_BUILD_TAGS=$(GO_BUILD_TAGS) \ | ||
--build-arg WIRE_TAGS=$(WIRE_TAGS) \ | ||
--build-arg COMMIT_SHA=$$(git rev-parse HEAD) \ | ||
--build-arg BUILD_BRANCH=$$(git rev-parse --abbrev-ref HEAD) \ | ||
- --tag grafana/grafana$(TAG_SUFFIX):dev \ | ||
+ --tag $(IMG_NAME) \ | ||
$(DOCKER_BUILD_ARGS) | ||
|
||
build-docker-full-ubuntu: ## Build Docker image based on Ubuntu for development. | ||
@echo "build docker container" | ||
tar -ch . | \ | ||
- docker buildx build - \ | ||
+ docker build - \ | ||
--platform $(PLATFORM) \ | ||
--build-arg BINGO=false \ | ||
--build-arg GO_BUILD_TAGS=$(GO_BUILD_TAGS) \ | ||
@@ -239,7 +240,7 @@ build-docker-full-ubuntu: ## Build Docker image based on Ubuntu for development. | ||
--build-arg BUILD_BRANCH=$$(git rev-parse --abbrev-ref HEAD) \ | ||
--build-arg BASE_IMAGE=ubuntu:22.04 \ | ||
--build-arg GO_IMAGE=golang:1.20.10 \ | ||
- --tag grafana/grafana$(TAG_SUFFIX):dev-ubuntu \ | ||
+ --tag $(IMG_NAME) \ | ||
$(DOCKER_BUILD_ARGS) | ||
|
||
##@ Services |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# This file is generated by the template. | ||
|
||
REGISTRY?=lcr.loongnix.cn | ||
ORGANIZATION?=grafana | ||
REPOSITORY?=grafana | ||
TAG?=10.2.2 | ||
LATEST?=false | ||
|
||
IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):$(TAG) | ||
LATEST_IMAGE=$(REGISTRY)/$(ORGANIZATION)/$(REPOSITORY):latest | ||
|
||
# SOURCE_URL is a url to download source, such as https://github.com/merore/merore.git. | ||
# SOURCE is project sources, its located at src/$(SORUCE). | ||
# PATCH is a patch that supports loong64 to $(SOURCE). | ||
# Be sure to fill in the follows!!! | ||
SOURCE_URL=https://github.com/grafana/grafana.git | ||
SOURCE=$(shell echo $(SOURCE_URL) | awk -F '/' '{print $$NF}' | awk -F '.' '{print $$1}') | ||
PATCH=0001-support-loong64.patch | ||
|
||
default: image | ||
|
||
src/$(SOURCE): | ||
git clone -b v$(TAG) --depth=1 $(SOURCE_URL) $@ | ||
cd $@ && \ | ||
git apply ../../$(PATCH) | ||
|
||
|
||
image: src/$(SOURCE) | ||
# Commands for building. | ||
IMG_NAME=$(IMAGE) PLATFORM=linux/loong64 \ | ||
DOCKER_BUILD_ARGS="--build-arg BASE_IMAGE=lcr.loongnix.cn/library/alpine:3.19 \ | ||
--build-arg JS_IMAGE=docker.m.daocloud.io/grafana/grafana:$(TAG) \ | ||
--build-arg https_proxy=${https_proxy} --build-arg http_proxy=${http_proxy} \ | ||
--build-arg GO_IMAGE=lcr.loongnix.cn/library/golang:1.21-alpine" \ | ||
$(MAKE) -C src/$(SOURCE) build-docker-full | ||
|
||
push: | ||
docker push $(IMAGE) | ||
|
||
clean: | ||
rm -rf src |