Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add grafana:9.0.1 #95

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
93 changes: 93 additions & 0 deletions grafana/grafana/9.0.1/0001-support-loong64.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
diff --git a/Dockerfile b/Dockerfile
index 3bee987..cce446d 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,26 +1,17 @@
-FROM node:16-alpine3.15 as js-builder
+ARG BASE_IMAGE=lcr.loongnix.cn/library/alpine:3.19
+#ARG JS_IMAGE=node:16-alpine3.15
+ARG JS_IMAGE=docker.m.daocloud.io/grafana/grafana:9.0.1
+ARG JS_PLATFORM=linux/amd64

-ENV NODE_OPTIONS=--max_old_space_size=8000
+FROM --platform=${JS_PLATFORM} ${JS_IMAGE} as js-builder

-WORKDIR /grafana
-
-COPY package.json yarn.lock .yarnrc.yml ./
-COPY .yarn .yarn
-COPY packages packages
-COPY plugins-bundled plugins-bundled
-
-RUN yarn install
-
-COPY tsconfig.json .eslintrc .editorconfig .browserslistrc .prettierrc.js babel.config.json .linguirc ./
-COPY public public
-COPY tools tools
-COPY scripts scripts
-COPY emails emails
+ARG GOPROXY
+ARG GO_IMAGE=lcr.loongnix.cn/library/golang:1.20-alpine

-ENV NODE_ENV production
-RUN yarn build
+#FROM ${GO_IMAGE} as go-builder
+FROM lcr.loongnix.cn/library/golang:1.20-alpine as go-builder

-FROM golang:1.17.11-alpine3.15 as go-builder
+ARG GOPROXY=https://goproxy.cn

RUN apk add --no-cache gcc g++ make

@@ -37,12 +28,12 @@ COPY cue.mod cue.mod
COPY .bingo .bingo

RUN go mod verify
-RUN make build-go
+RUN go get github.com/mattn/go-sqlite3 && make build-go

# Final stage
-FROM alpine:3.15
+FROM ${BASE_IMAGE}

-LABEL maintainer="Grafana team <[email protected]>"
+LABEL maintainer="Zhaixiaojuan <[email protected]>"

ARG GF_UID="472"
ARG GF_GID="0"
@@ -58,8 +49,8 @@ ENV PATH="/usr/share/grafana/bin:$PATH" \
WORKDIR $GF_PATHS_HOME

RUN apk add --no-cache ca-certificates bash tzdata musl-utils
-RUN apk add --no-cache openssl ncurses-libs ncurses-terminfo-base --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
-RUN apk upgrade ncurses-libs ncurses-terminfo-base --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main
+RUN apk add --no-cache openssl ncurses-libs ncurses-terminfo-base
+RUN apk upgrade ncurses-libs ncurses-terminfo-base
RUN apk info -vv | sort

COPY conf ./conf
@@ -85,8 +76,9 @@ RUN export GF_GID_NAME=$(getent group $GF_GID | cut -d':' -f1) && \
chmod -R 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING"

COPY --from=go-builder /grafana/bin/*/grafana-server /grafana/bin/*/grafana-cli ./bin/
-COPY --from=js-builder /grafana/public ./public
-COPY --from=js-builder /grafana/tools ./tools
+COPY --from=js-builder /usr/share/grafana/public ./public
+#COPY --from=go-builder /grafana/LICENSE ./
+#COPY --from=js-builder /grafana/tools ./tools

EXPOSE 3000

diff --git a/Makefile b/Makefile
index 12cd5e7..389a9ef 100644
--- a/Makefile
+++ b/Makefile
@@ -150,7 +150,7 @@ shellcheck: $(SH_FILES) ## Run checks for shell scripts.

build-docker-full: ## Build Docker image for development.
@echo "build docker container"
- docker build --tag grafana/grafana:dev .
+ docker build --tag lcr.loongnix.cn/grafana/grafana:9.0.1 .

build-docker-full-ubuntu: ## Build Docker image based on Ubuntu for development.
@echo "build docker container"
45 changes: 45 additions & 0 deletions grafana/grafana/9.0.1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file is generated by the template.

REGISTRY?=lcr.loongnix.cn
ORGANIZATION?=grafana
REPOSITORY?=grafana
TAG?=9.0.1
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

GOPROXY ?= https://goproxy.cn,https://mirrors.aliyun.com/goproxy/,https://goproxy.io,direct

default: image

src/$(SOURCE):
echo "0928 test"
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 GOPROXY=$(GOPROXY) \
--build-arg GO_IMAGE=lcr.loongnix.cn/library/golang:1.20-alpine" \
$(MAKE) -C src/$(SOURCE) build-docker-full

push:
docker push $(IMAGE)

clean:
rm -rf src
Loading