mirror of
https://github.com/grafana/grafana.git
synced 2024-12-30 10:47:30 -06:00
88 lines
2.5 KiB
Docker
88 lines
2.5 KiB
Docker
FROM node:16-alpine3.15 as js-builder
|
|
|
|
ENV NODE_OPTIONS=--max_old_space_size=8000
|
|
|
|
WORKDIR /usr/src/app/
|
|
|
|
COPY package.json yarn.lock ./
|
|
COPY packages packages
|
|
COPY .yarnrc.yml ./
|
|
COPY .yarn .yarn
|
|
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
|
|
|
|
ENV NODE_ENV production
|
|
RUN yarn build
|
|
|
|
FROM golang:1.19.2 AS go-builder
|
|
|
|
WORKDIR /src/grafana
|
|
|
|
COPY go.mod go.sum embed.go ./
|
|
COPY Makefile build.go package.json ./
|
|
COPY .bingo .bingo
|
|
COPY pkg pkg/
|
|
COPY cue.mod cue.mod/
|
|
COPY packages/grafana-schema packages/grafana-schema/
|
|
COPY public/app/plugins public/app/plugins/
|
|
COPY public/api-spec.json public/api-spec.json
|
|
|
|
RUN go mod verify
|
|
RUN make build-go
|
|
|
|
FROM ubuntu:20.04
|
|
|
|
LABEL maintainer="Grafana team <hello@grafana.com>"
|
|
EXPOSE 3000
|
|
|
|
ARG GF_UID="472"
|
|
ARG GF_GID="472"
|
|
|
|
ENV PATH="/usr/share/grafana/bin:$PATH" \
|
|
GF_PATHS_CONFIG="/etc/grafana/grafana.ini" \
|
|
GF_PATHS_DATA="/var/lib/grafana" \
|
|
GF_PATHS_HOME="/usr/share/grafana" \
|
|
GF_PATHS_LOGS="/var/log/grafana" \
|
|
GF_PATHS_PLUGINS="/var/lib/grafana/plugins" \
|
|
GF_PATHS_PROVISIONING="/etc/grafana/provisioning"
|
|
|
|
WORKDIR $GF_PATHS_HOME
|
|
|
|
COPY conf conf
|
|
|
|
# curl should be part of the image
|
|
RUN apt-get update && apt-get install -y ca-certificates curl
|
|
|
|
RUN mkdir -p "$GF_PATHS_HOME/.aws" && \
|
|
addgroup --system --gid $GF_GID grafana && \
|
|
adduser --uid $GF_UID --system --ingroup grafana grafana && \
|
|
mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
|
|
"$GF_PATHS_PROVISIONING/dashboards" \
|
|
"$GF_PATHS_PROVISIONING/notifiers" \
|
|
"$GF_PATHS_PROVISIONING/plugins" \
|
|
"$GF_PATHS_PROVISIONING/access-control" \
|
|
"$GF_PATHS_PROVISIONING/alerting" \
|
|
"$GF_PATHS_LOGS" \
|
|
"$GF_PATHS_PLUGINS" \
|
|
"$GF_PATHS_DATA" && \
|
|
cp conf/sample.ini "$GF_PATHS_CONFIG" && \
|
|
cp conf/ldap.toml /etc/grafana/ldap.toml && \
|
|
chown -R grafana:grafana "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING" && \
|
|
chmod -R 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING"
|
|
|
|
COPY --from=go-builder /src/grafana/bin/*/grafana-server /src/grafana/bin/*/grafana-cli bin/
|
|
COPY --from=js-builder /usr/src/app/public public
|
|
COPY --from=js-builder /usr/src/app/tools tools
|
|
|
|
COPY packaging/docker/run.sh /
|
|
|
|
USER grafana
|
|
ENTRYPOINT [ "/run.sh" ]
|