Build container: Base build image on Debian Stretch (#24967)

* scripts/build/ci-build: Fix Makefile
* scripts/build/ci-build: Base Docker image on Debian Stretch
* scripts/build/ci-build: Modify Dockerfile for fewer RUN directives
This commit is contained in:
Arve Knudsen 2020-05-26 15:45:49 +02:00 committed by GitHub
parent 7f6b75af70
commit 170abf2e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 17 deletions

View File

@ -1,4 +1,5 @@
FROM ubuntu:20.04 as toolchain
# Use old Debian (this has support into 2022) in order to ensure binary compatibility with older glibc's.
FROM debian:stretch-20200514 AS toolchain
ENV OSX_SDK_URL=https://s3.dockerproject.org/darwin/v2 \
OSX_SDK=MacOSX10.10.sdk \
@ -71,8 +72,9 @@ RUN cd /tmp && \
rm -rf /tmp/x86_64-centos6-linux-gnu/ && \
rm -rf /tmp/crosstool-ng-${CTNG}
# base image to crossbuild grafana
FROM ubuntu:20.04
# Base image to crossbuild grafana.
# Use old Debian (this has support into 2022) in order to ensure binary compatibility with older glibc's.
FROM debian:stretch-20200514
ENV GOVERSION=1.14.1 \
PATH=/usr/local/go/bin:$PATH \
@ -86,7 +88,7 @@ COPY --from=toolchain /tmp/x86_64-centos6-linux-gnu.tar.xz /tmp/osxcross.tar.xz
RUN apt-get update && \
apt-get upgrade -yq && \
apt-get install -yq \
clang gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-mingw-w64-x86-64 \
build-essential clang gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-mingw-w64-x86-64 \
apt-transport-https \
ca-certificates \
curl \
@ -99,7 +101,12 @@ RUN apt-get update && \
xz-utils \
expect \
gnupg2 \
procps \
ruby \
ruby-dev \
rubygems \
unzip && \
gem install -N fpm && \
ln -s /usr/bin/llvm-dsymutil-6.0 /usr/bin/dsymutil && \
curl -fL https://nodejs.org/dist/v${NODEVERSION}/node-v${NODEVERSION}-linux-x64.tar.xz \
| tar -xJ --strip-components=1 -C /usr/local && \
@ -130,9 +137,4 @@ RUN cd /tmp && \
tar xf x86_64-linux-musl-cross.tgz && \
rm x86_64-linux-musl-cross.tgz
RUN apt-get install -yq gcc libc-dev make && \
gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB && \
curl -fsSL https://get.rvm.io | bash -s stable && \
/bin/bash -l -c "rvm requirements && rvm install 2.2 && gem install -N fpm"
COPY ./bootstrap.sh /tmp/bootstrap.sh

View File

@ -1,7 +1,7 @@
VERSION="dev"
TAG="grafana/build-container"
USER_ID=$(shell id -u)
GROUP_ID=$(shell id -g)
VERSION = dev
TAG = grafana/build-container
USER_ID = $(shell id -u)
GROUP_ID = $(shell id -g)
all: build deploy
@ -41,7 +41,7 @@ run-with-local-source-copy:
docker exec -ti grafana-build bash
update-source:
docker cp "${GOPATH}/src/github.com/grafana/grafana" grafana-build:/go/src/github.com/grafana/
docker cp "${GOPATH}/src/github.com/grafana/grafana" grafana-build:/go/src/github.com/grafana/
attach:
docker exec -ti grafana-build bash

View File

@ -1,9 +1,10 @@
# grafana-build-container
Grafana build container
## Description
These are the sources for the Docker image that we use for the Grafana build containers. The image source itself
is in Dockerfile, but there are supporting scripts such as the Makefile, for building images.
This is a container for cross-platform builds of Grafana. You can run it locally using the Makefile.
The image is based on Debian Stretch, since we want an older Linux distribution (Stretch has long-term support into
2022) to build binaries that are as portable as possible.
## Makefile targets