2022-11-15 07:47:14 -06:00
|
|
|
FROM node:16-alpine3.15 as js-builder
|
2019-08-16 10:46:35 -05:00
|
|
|
|
2021-10-28 09:41:10 -05:00
|
|
|
ENV NODE_OPTIONS=--max_old_space_size=8000
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2021-10-28 09:41:10 -05:00
|
|
|
WORKDIR /grafana
|
|
|
|
|
|
|
|
COPY package.json yarn.lock .yarnrc.yml ./
|
2021-10-26 05:08:31 -05:00
|
|
|
COPY .yarn .yarn
|
2019-01-25 03:50:05 -06:00
|
|
|
COPY packages packages
|
2021-10-26 05:08:31 -05:00
|
|
|
COPY plugins-bundled plugins-bundled
|
2019-01-25 03:50:05 -06:00
|
|
|
|
2021-10-26 05:08:31 -05:00
|
|
|
RUN yarn install
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2022-02-08 06:38:43 -06:00
|
|
|
COPY tsconfig.json .eslintrc .editorconfig .browserslistrc .prettierrc.js babel.config.json .linguirc ./
|
2018-02-06 18:58:37 -06:00
|
|
|
COPY public public
|
2020-04-22 04:11:19 -05:00
|
|
|
COPY tools tools
|
2018-02-06 18:58:37 -06:00
|
|
|
COPY scripts scripts
|
|
|
|
COPY emails emails
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
ENV NODE_ENV production
|
2020-12-02 08:49:48 -06:00
|
|
|
RUN yarn build
|
2018-01-29 05:01:05 -06:00
|
|
|
|
2022-11-04 08:50:43 -05:00
|
|
|
FROM golang:1.19.3-alpine3.15 as go-builder
|
2020-05-04 04:59:10 -05:00
|
|
|
|
2021-10-26 05:08:31 -05:00
|
|
|
RUN apk add --no-cache gcc g++ make
|
2020-05-04 04:59:10 -05:00
|
|
|
|
2021-10-28 09:41:10 -05:00
|
|
|
WORKDIR /grafana
|
2020-05-04 04:59:10 -05:00
|
|
|
|
2021-10-28 09:41:10 -05:00
|
|
|
COPY go.mod go.sum embed.go Makefile build.go package.json ./
|
2021-09-09 00:54:36 -05:00
|
|
|
COPY packages/grafana-schema packages/grafana-schema
|
2021-05-04 02:43:12 -05:00
|
|
|
COPY public/app/plugins public/app/plugins
|
2022-02-08 06:38:43 -06:00
|
|
|
COPY public/api-spec.json public/api-spec.json
|
2020-05-04 04:59:10 -05:00
|
|
|
COPY pkg pkg
|
2021-10-28 09:41:10 -05:00
|
|
|
COPY scripts scripts
|
|
|
|
COPY cue.mod cue.mod
|
2021-10-26 05:08:31 -05:00
|
|
|
COPY .bingo .bingo
|
2020-05-04 04:59:10 -05:00
|
|
|
|
2021-07-27 04:50:25 -05:00
|
|
|
RUN go mod verify
|
2021-10-26 05:08:31 -05:00
|
|
|
RUN make build-go
|
2020-05-04 04:59:10 -05:00
|
|
|
|
|
|
|
# Final stage
|
2022-08-15 11:17:55 -05:00
|
|
|
FROM alpine:3.15.6
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2019-05-13 03:51:16 -05:00
|
|
|
LABEL maintainer="Grafana team <hello@grafana.com>"
|
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
ARG GF_UID="472"
|
2020-11-23 05:29:53 -06:00
|
|
|
ARG GF_GID="0"
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2019-11-04 12:55:40 -06:00
|
|
|
ENV PATH="/usr/share/grafana/bin:$PATH" \
|
2021-11-04 09:13:10 -05:00
|
|
|
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"
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
WORKDIR $GF_PATHS_HOME
|
|
|
|
|
2021-10-18 12:50:10 -05:00
|
|
|
RUN apk add --no-cache ca-certificates bash tzdata musl-utils
|
2021-10-28 09:41:10 -05:00
|
|
|
RUN apk info -vv | sort
|
2018-08-07 09:11:37 -05:00
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
COPY conf ./conf
|
|
|
|
|
2020-11-23 05:29:53 -06:00
|
|
|
RUN if [ ! $(getent group "$GF_GID") ]; then \
|
2021-11-04 09:13:10 -05:00
|
|
|
addgroup -S -g $GF_GID grafana; \
|
|
|
|
fi
|
2020-11-23 05:29:53 -06:00
|
|
|
|
|
|
|
RUN export GF_GID_NAME=$(getent group $GF_GID | cut -d':' -f1) && \
|
2021-11-04 09:13:10 -05:00
|
|
|
mkdir -p "$GF_PATHS_HOME/.aws" && \
|
|
|
|
adduser -S -u $GF_UID -G "$GF_GID_NAME" grafana && \
|
|
|
|
mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
|
|
|
|
"$GF_PATHS_PROVISIONING/dashboards" \
|
|
|
|
"$GF_PATHS_PROVISIONING/notifiers" \
|
|
|
|
"$GF_PATHS_PROVISIONING/plugins" \
|
|
|
|
"$GF_PATHS_PROVISIONING/access-control" \
|
2022-08-11 17:16:02 -05:00
|
|
|
"$GF_PATHS_PROVISIONING/alerting" \
|
2021-11-04 09:13:10 -05:00
|
|
|
"$GF_PATHS_LOGS" \
|
|
|
|
"$GF_PATHS_PLUGINS" \
|
|
|
|
"$GF_PATHS_DATA" && \
|
|
|
|
cp "$GF_PATHS_HOME/conf/sample.ini" "$GF_PATHS_CONFIG" && \
|
|
|
|
cp "$GF_PATHS_HOME/conf/ldap.toml" /etc/grafana/ldap.toml && \
|
|
|
|
chown -R "grafana:$GF_GID_NAME" "$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"
|
2019-08-16 10:46:35 -05:00
|
|
|
|
2021-11-04 10:35:32 -05:00
|
|
|
COPY --from=go-builder /grafana/bin/*/grafana-server /grafana/bin/*/grafana-cli ./bin/
|
2021-10-28 09:41:10 -05:00
|
|
|
COPY --from=js-builder /grafana/public ./public
|
|
|
|
COPY --from=js-builder /grafana/tools ./tools
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2018-08-07 09:11:37 -05:00
|
|
|
COPY ./packaging/docker/run.sh /run.sh
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
USER grafana
|
|
|
|
ENTRYPOINT [ "/run.sh" ]
|