mirror of
https://github.com/armbian/build
synced 2025-09-24 19:47:06 +07:00
Docker build speed up. (#1451)
* Docker: a chance to rebuild docker image when Dockerfile is updated, docker image will not be rebuilt, let armbian docker image tag with framework version, thus has a chance to rebuild it. V2: use VERSION file to track build script version. Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com> * Docker: use upgrade instead of dist-upgrade to speed up docker build this patch also change to use apt instead of apt-get when compile in docker, it will run apt update&&upgrade everytime. this is very time consuming. apt-get dist-upgrade will not upgrade packages, thus will make build framework do upgrade each time. Signed-off-by: Zhang Ning <832666+zhangn1985@users.noreply.github.com>
This commit is contained in:
committed by
Igor Pečovnik
parent
bb4a94d828
commit
94027c0f58
@@ -1,6 +1,6 @@
|
||||
FROM ubuntu:18.04
|
||||
RUN dpkg --add-architecture i386
|
||||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y dist-upgrade && \
|
||||
RUN apt update && DEBIAN_FRONTEND=noninteractive apt -y upgrade && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y git dialog lsb-release binutils wget ca-certificates device-tree-compiler \
|
||||
pv bc lzop zip binfmt-support build-essential ccache debootstrap ntpdate gawk gcc-arm-linux-gnueabihf \
|
||||
qemu-user-static u-boot-tools uuid-dev zlib1g-dev unzip libusb-1.0-0-dev parted pkg-config libncurses5-dev whiptail \
|
||||
|
||||
@@ -13,13 +13,14 @@ shift
|
||||
mkdir -p $SRC/{output,userpatches}
|
||||
grep -q '^docker:' /etc/group && chgrp --quiet docker $SRC/{output,userpatches}
|
||||
chmod --quiet g+w,g+s $SRC/{output,userpatches}
|
||||
|
||||
if grep -q armbian <(docker images); then
|
||||
VERSION=$(cat VERSION)
|
||||
if grep -q $VERSION <(grep armbian <(docker images)); then
|
||||
display_alert "Using existed a armbian Docker container"
|
||||
else
|
||||
# build a new container based on provided Dockerfile
|
||||
display_alert "Docker container not found or out of date"
|
||||
display_alert "Building a Docker container"
|
||||
if ! docker build -t armbian . ; then
|
||||
if ! docker build -t armbian:$VERSION . ; then
|
||||
STATUS=$?
|
||||
# Adding a newline, so the alert won't be shown in the same line as the error
|
||||
echo
|
||||
@@ -82,7 +83,7 @@ DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`")
|
||||
# pass other command line arguments like KERNEL_ONLY=yes, KERNEL_CONFIGURE=yes, etc.
|
||||
# pass "docker-guest" as an additional config name that will be sourced in the container if exists
|
||||
display_alert "Running the container" "" "info"
|
||||
docker run "${DOCKER_FLAGS[@]}" -it armbian docker-guest "$@"
|
||||
docker run "${DOCKER_FLAGS[@]}" -it armbian:$VERSION docker-guest "$@"
|
||||
|
||||
# Docker error treatment
|
||||
STATUS=$?
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
# common options
|
||||
# daily beta build contains date in subrevision
|
||||
if [[ $BETA == yes && -z $SUBREVISION ]]; then SUBREVISION="."$(date --date="tomorrow" +"%y%m%d"); fi
|
||||
REVISION="5.91$SUBREVISION" # all boards have same revision
|
||||
REVISION=$(cat VERSION)"$SUBREVISION" # all boards have same revision
|
||||
ROOTPWD="1234" # Must be changed @first login
|
||||
[[ -z $MAINTAINER ]] && MAINTAINER="Igor Pecovnik" # deb signature
|
||||
[[ -z $MAINTAINERMAIL ]] && MAINTAINERMAIL="igor.pecovnik@****l.com" # deb signature
|
||||
|
||||
Reference in New Issue
Block a user