2021-08-20 06:54:03 -05:00
|
|
|
FROM node:16-alpine3.14 as js-builder
|
2019-08-16 10:46:35 -05:00
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
WORKDIR /usr/src/app/
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
COPY package.json yarn.lock ./
|
2019-01-25 03:50:05 -06:00
|
|
|
COPY packages packages
|
|
|
|
|
2021-03-12 04:28:54 -06:00
|
|
|
RUN apk --no-cache add git
|
2018-08-07 09:11:37 -05:00
|
|
|
RUN yarn install --pure-lockfile --no-progress
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2020-12-02 02:15:53 -06:00
|
|
|
COPY tsconfig.json .eslintrc .editorconfig .browserslistrc .prettierrc.js ./
|
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
|
|
|
|
2021-08-31 01:19:26 -05:00
|
|
|
FROM golang:1.17.0-alpine3.14 as go-builder
|
2020-05-04 04:59:10 -05:00
|
|
|
|
|
|
|
RUN apk add --no-cache gcc g++
|
|
|
|
|
|
|
|
WORKDIR $GOPATH/src/github.com/grafana/grafana
|
|
|
|
|
2021-05-04 02:43:12 -05:00
|
|
|
COPY go.mod go.sum embed.go ./
|
|
|
|
COPY cue cue
|
|
|
|
COPY public/app/plugins public/app/plugins
|
2020-05-04 04:59:10 -05:00
|
|
|
COPY pkg pkg
|
|
|
|
COPY build.go package.json ./
|
|
|
|
|
2021-07-27 04:50:25 -05:00
|
|
|
RUN go mod verify
|
2020-05-04 04:59:10 -05:00
|
|
|
RUN go run build.go build
|
|
|
|
|
|
|
|
# Final stage
|
2021-09-02 03:45:33 -05:00
|
|
|
FROM alpine:3.14.2
|
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" \
|
2018-04-20 13:28:52 -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"
|
|
|
|
|
|
|
|
WORKDIR $GF_PATHS_HOME
|
|
|
|
|
2019-10-30 03:33:27 -05:00
|
|
|
RUN apk add --no-cache ca-certificates bash tzdata && \
|
2021-08-26 08:22:53 -05:00
|
|
|
apk add --no-cache openssl musl-utils libcrypto1.1>1.1.1l-r0 libssl1.1>1.1.1l-r0
|
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 \
|
|
|
|
addgroup -S -g $GF_GID grafana; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
RUN export GF_GID_NAME=$(getent group $GF_GID | cut -d':' -f1) && \
|
|
|
|
mkdir -p "$GF_PATHS_HOME/.aws" && \
|
|
|
|
adduser -S -u $GF_UID -G "$GF_GID_NAME" grafana && \
|
2018-04-20 13:28:52 -05:00
|
|
|
mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
|
|
|
|
"$GF_PATHS_PROVISIONING/dashboards" \
|
2019-02-11 04:17:23 -06:00
|
|
|
"$GF_PATHS_PROVISIONING/notifiers" \
|
2020-12-03 07:17:40 -06:00
|
|
|
"$GF_PATHS_PROVISIONING/plugins" \
|
2021-05-20 02:41:39 -05:00
|
|
|
"$GF_PATHS_PROVISIONING/access-control" \
|
2018-04-20 13:28:52 -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 && \
|
2020-11-23 05:29:53 -06:00
|
|
|
chown -R "grafana:$GF_GID_NAME" "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING" && \
|
2019-08-16 10:46:35 -05:00
|
|
|
chmod -R 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" "$GF_PATHS_PROVISIONING"
|
|
|
|
|
2021-05-04 02:43:12 -05:00
|
|
|
COPY --from=go-builder /go/src/github.com/grafana/grafana/bin/*/grafana-server /go/src/github.com/grafana/grafana/bin/*/grafana-cli ./bin/
|
2020-04-30 06:42:06 -05:00
|
|
|
COPY --from=js-builder /usr/src/app/public ./public
|
|
|
|
COPY --from=js-builder /usr/src/app/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" ]
|