2018-04-20 13:28:52 -05:00
|
|
|
# Golang build container
|
|
|
|
FROM golang:1.10
|
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
WORKDIR $GOPATH/src/github.com/grafana/grafana
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
COPY Gopkg.toml Gopkg.lock ./
|
2018-04-20 13:28:52 -05:00
|
|
|
COPY vendor vendor
|
|
|
|
|
|
|
|
ARG DEP_ENSURE=""
|
|
|
|
RUN if [ ! -z "${DEP_ENSURE}" ]; then \
|
|
|
|
go get -u github.com/golang/dep/cmd/dep && \
|
|
|
|
dep ensure --vendor-only; \
|
|
|
|
fi
|
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
COPY pkg pkg
|
2018-04-20 13:28:52 -05:00
|
|
|
RUN go install -ldflags="-s -w" ./pkg/cmd/grafana-server && \
|
|
|
|
go install -ldflags="-s -w" ./pkg/cmd/grafana-cli
|
2018-01-29 05:01:05 -06:00
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
# Node build container
|
2018-01-29 05:01:05 -06:00
|
|
|
FROM node:8
|
2018-04-20 13:28:52 -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 ./
|
|
|
|
RUN yarn install --frozen-lockfile
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2018-02-06 18:58:37 -06:00
|
|
|
COPY Gruntfile.js tsconfig.json tslint.json ./
|
|
|
|
COPY public public
|
|
|
|
COPY scripts scripts
|
|
|
|
COPY emails emails
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
ENV NODE_ENV production
|
2018-01-29 05:01:05 -06:00
|
|
|
RUN yarn run build
|
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
# Final container
|
2018-01-29 05:01:05 -06:00
|
|
|
FROM debian:stretch-slim
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
ARG GF_UID="472"
|
|
|
|
ARG GF_GID="472"
|
|
|
|
|
|
|
|
ENV PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin \
|
|
|
|
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
|
|
|
|
|
|
|
|
RUN mkdir -p "$GF_PATHS_HOME/.aws" && \
|
|
|
|
groupadd -r -g $GF_GID grafana && \
|
|
|
|
useradd -r -u $GF_UID -g grafana grafana && \
|
|
|
|
mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
|
|
|
|
"$GF_PATHS_PROVISIONING/dashboards" \
|
|
|
|
"$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:grafana "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS" && \
|
|
|
|
chmod 777 "$GF_PATHS_DATA" "$GF_PATHS_HOME/.aws" "$GF_PATHS_LOGS" "$GF_PATHS_PLUGINS"
|
|
|
|
|
2018-02-06 18:58:37 -06:00
|
|
|
COPY --from=0 /go/bin/grafana-server /go/bin/grafana-cli ./bin/
|
2018-01-29 05:01:05 -06:00
|
|
|
COPY --from=1 /usr/src/app/public ./public
|
|
|
|
COPY --from=1 /usr/src/app/tools ./tools
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
EXPOSE 3000
|
|
|
|
|
2018-05-08 11:14:38 -05:00
|
|
|
COPY ./scripts/docker/run.sh /run.sh
|
2018-04-20 13:28:52 -05:00
|
|
|
|
|
|
|
USER grafana
|
|
|
|
ENTRYPOINT [ "/run.sh" ]
|