2020-10-12 00:10:50 -05:00
|
|
|
FROM node:12.19.0-alpine3.12 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
|
|
|
|
|
2018-08-07 09:11:37 -05:00
|
|
|
RUN yarn install --pure-lockfile --no-progress
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2020-04-22 03:18:36 -05:00
|
|
|
COPY Gruntfile.js 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
|
2018-08-07 09:11:37 -05:00
|
|
|
RUN ./node_modules/.bin/grunt build
|
2018-01-29 05:01:05 -06:00
|
|
|
|
2020-09-02 08:51:19 -05:00
|
|
|
FROM golang:1.15.1-alpine3.12 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
|
|
|
|
|
|
|
|
COPY go.mod go.sum ./
|
|
|
|
|
|
|
|
RUN go mod verify
|
|
|
|
|
|
|
|
COPY pkg pkg
|
|
|
|
COPY build.go package.json ./
|
|
|
|
|
|
|
|
RUN go run build.go build
|
|
|
|
|
|
|
|
# Final stage
|
2020-06-30 07:26:02 -05:00
|
|
|
FROM alpine:3.12
|
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"
|
|
|
|
ARG GF_GID="472"
|
|
|
|
|
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 && \
|
2020-07-28 10:07:23 -05:00
|
|
|
apk add --no-cache openssl musl-utils
|
2018-08-07 09:11:37 -05:00
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
COPY conf ./conf
|
|
|
|
|
|
|
|
RUN mkdir -p "$GF_PATHS_HOME/.aws" && \
|
2019-08-16 10:46:35 -05:00
|
|
|
addgroup -S -g $GF_GID grafana && \
|
|
|
|
adduser -S -u $GF_UID -G grafana 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" \
|
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 && \
|
2019-05-10 02:03:17 -05:00
|
|
|
chown -R grafana:grafana "$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"
|
|
|
|
|
2020-04-30 06:42:06 -05:00
|
|
|
COPY --from=go-builder /go/src/github.com/grafana/grafana/bin/linux-amd64/grafana-server /go/src/github.com/grafana/grafana/bin/linux-amd64/grafana-cli ./bin/
|
|
|
|
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" ]
|