2018-04-20 13:28:52 -05:00
|
|
|
# Golang build container
|
2019-10-08 01:32:18 -05:00
|
|
|
FROM golang:1.13.1-alpine
|
2019-08-25 09:20:52 -05:00
|
|
|
|
|
|
|
RUN apk add --no-cache gcc g++
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
WORKDIR $GOPATH/src/github.com/grafana/grafana
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2019-04-30 05:01:43 -05:00
|
|
|
COPY go.mod go.sum ./
|
2018-04-20 13:28:52 -05:00
|
|
|
COPY vendor vendor
|
|
|
|
|
2019-04-30 05:01:43 -05:00
|
|
|
RUN go mod verify
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2018-01-29 05:01:05 -06:00
|
|
|
COPY pkg pkg
|
2019-11-04 12:55:40 -06:00
|
|
|
COPY build.go package.json ./
|
2018-08-07 09:11:37 -05:00
|
|
|
|
|
|
|
RUN go run build.go build
|
2018-01-29 05:01:05 -06:00
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
# Node build container
|
2019-08-16 10:46:35 -05:00
|
|
|
FROM node:10.14.2-alpine
|
|
|
|
|
|
|
|
# PhantomJS
|
|
|
|
RUN apk add --no-cache curl &&\
|
|
|
|
cd /tmp && curl -Ls https://github.com/dustinblackman/phantomized/releases/download/2.1.1/dockerized-phantomjs.tar.gz | tar xz &&\
|
|
|
|
cp -R lib lib64 / &&\
|
|
|
|
cp -R usr/lib/x86_64-linux-gnu /usr/lib &&\
|
|
|
|
cp -R usr/share /usr/share &&\
|
|
|
|
cp -R etc/fonts /etc &&\
|
|
|
|
curl -k -Ls https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-linux-x86_64.tar.bz2 | tar -jxf - &&\
|
|
|
|
cp phantomjs-2.1.1-linux-x86_64/bin/phantomjs /usr/local/bin/phantomjs
|
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 ./
|
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
|
|
|
|
2019-07-16 09:57:31 -05:00
|
|
|
COPY Gruntfile.js tsconfig.json tslint.json .browserslistrc ./
|
2018-02-06 18:58:37 -06:00
|
|
|
COPY public public
|
|
|
|
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
|
|
|
|
2018-04-20 13:28:52 -05:00
|
|
|
# Final container
|
2019-08-16 10:46:35 -05:00
|
|
|
FROM alpine:3.10
|
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 && \
|
2019-09-18 12:32:14 -05:00
|
|
|
apk add --no-cache --upgrade --repository=http://dl-cdn.alpinelinux.org/alpine/edge/main 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"
|
|
|
|
|
|
|
|
# PhantomJS
|
|
|
|
COPY --from=1 /tmp/lib /lib
|
|
|
|
COPY --from=1 /tmp/lib64 /lib64
|
|
|
|
COPY --from=1 /tmp/usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu
|
|
|
|
COPY --from=1 /tmp/usr/share /usr/share
|
|
|
|
COPY --from=1 /tmp/etc/fonts /etc/fonts
|
|
|
|
COPY --from=1 /usr/local/bin/phantomjs /usr/local/bin
|
2018-04-20 13:28:52 -05:00
|
|
|
|
2018-08-07 09:11:37 -05:00
|
|
|
COPY --from=0 /go/src/github.com/grafana/grafana/bin/linux-amd64/grafana-server /go/src/github.com/grafana/grafana/bin/linux-amd64/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-08-07 09:11:37 -05:00
|
|
|
COPY tools/phantomjs/render.js ./tools/phantomjs/render.js
|
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" ]
|