Commit a73fc4a6 by Leonard Gram Committed by GitHub

Smaller docker image (#12824)

* build: makes the grafana docker image smaller.

* build: branches and PR:s builds the docker image.
parent b3c25076
...@@ -194,6 +194,18 @@ jobs: ...@@ -194,6 +194,18 @@ jobs:
- run: cp dist/grafana-latest.linux-x64.tar.gz packaging/docker - run: cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
- run: cd packaging/docker && ./build-deploy.sh "master-${CIRCLE_SHA1}" - run: cd packaging/docker && ./build-deploy.sh "master-${CIRCLE_SHA1}"
grafana-docker-pr:
docker:
- image: docker:stable-git
steps:
- checkout
- attach_workspace:
at: .
- setup_remote_docker
- run: docker info
- run: cp dist/grafana-latest.linux-x64.tar.gz packaging/docker
- run: cd packaging/docker && ./build.sh "${CIRCLE_SHA1}"
grafana-docker-release: grafana-docker-release:
docker: docker:
- image: docker:stable-git - image: docker:stable-git
...@@ -387,3 +399,13 @@ workflows: ...@@ -387,3 +399,13 @@ workflows:
filters: *filter-not-release-or-master filters: *filter-not-release-or-master
- postgres-integration-test: - postgres-integration-test:
filters: *filter-not-release-or-master filters: *filter-not-release-or-master
- grafana-docker-pr:
requires:
- build
- test-backend
- test-frontend
- codespell
- gometalinter
- mysql-integration-test
- postgres-integration-test
filters: *filter-not-release-or-master
FROM debian:stretch-slim FROM debian:stretch-slim
ARG GRAFANA_TGZ="grafana-latest.linux-x64.tar.gz" ARG GRAFANA_TGZ="grafana-latest.linux-x64.tar.gz"
RUN apt-get update && apt-get install -qq -y tar && \
apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/*
COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz
RUN mkdir /tmp/grafana && tar xfvz /tmp/grafana.tar.gz --strip-components=1 -C /tmp/grafana
FROM debian:stretch-slim
ARG GF_UID="472" ARG GF_UID="472"
ARG GF_GID="472" ARG GF_GID="472"
...@@ -12,15 +23,13 @@ ENV PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi ...@@ -12,15 +23,13 @@ ENV PATH=/usr/share/grafana/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bi
GF_PATHS_PLUGINS="/var/lib/grafana/plugins" \ GF_PATHS_PLUGINS="/var/lib/grafana/plugins" \
GF_PATHS_PROVISIONING="/etc/grafana/provisioning" GF_PATHS_PROVISIONING="/etc/grafana/provisioning"
RUN apt-get update && apt-get install -qq -y tar libfontconfig ca-certificates && \ RUN apt-get update && apt-get install -qq -y libfontconfig ca-certificates && \
apt-get autoremove -y && \ apt-get autoremove -y && \
rm -rf /var/lib/apt/lists/* rm -rf /var/lib/apt/lists/*
COPY ${GRAFANA_TGZ} /tmp/grafana.tar.gz COPY --from=0 /tmp/grafana "$GF_PATHS_HOME"
RUN mkdir -p "$GF_PATHS_HOME/.aws" && \ RUN mkdir -p "$GF_PATHS_HOME/.aws" && \
tar xfvz /tmp/grafana.tar.gz --strip-components=1 -C "$GF_PATHS_HOME" && \
rm /tmp/grafana.tar.gz && \
groupadd -r -g $GF_GID grafana && \ groupadd -r -g $GF_GID grafana && \
useradd -r -u $GF_UID -g grafana grafana && \ useradd -r -u $GF_UID -g grafana grafana && \
mkdir -p "$GF_PATHS_PROVISIONING/datasources" \ mkdir -p "$GF_PATHS_PROVISIONING/datasources" \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment