Fix docker build and git ownership issue (#228)
This commit is contained in:
parent
1792ddca8d
commit
ad7c5192c4
|
|
@ -1,4 +1,4 @@
|
||||||
FROM ubuntu:21.04
|
FROM ubuntu:22.04
|
||||||
ARG DEBIAN_FRONTEND=noninteractive
|
ARG DEBIAN_FRONTEND=noninteractive
|
||||||
RUN apt-get update && apt-get -y install \
|
RUN apt-get update && apt-get -y install \
|
||||||
joe \
|
joe \
|
||||||
|
|
@ -45,7 +45,6 @@ RUN apt-get update \
|
||||||
f2fs-tools \
|
f2fs-tools \
|
||||||
fakeroot \
|
fakeroot \
|
||||||
flex \
|
flex \
|
||||||
g++-8-arm-linux-gnueabihf \
|
|
||||||
gawk \
|
gawk \
|
||||||
gcc-arm-linux-gnueabihf \
|
gcc-arm-linux-gnueabihf \
|
||||||
gcc-arm-linux-gnueabi \
|
gcc-arm-linux-gnueabi \
|
||||||
|
|
@ -114,6 +113,8 @@ RUN apt-get update \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
RUN locale-gen en_US.UTF-8
|
RUN locale-gen en_US.UTF-8
|
||||||
|
|
||||||
|
RUN git config --system --add safe.directory /root/orangepi
|
||||||
|
|
||||||
# Static port for NFSv3 server used for USB FEL boot
|
# Static port for NFSv3 server used for USB FEL boot
|
||||||
RUN sed -i 's/\(^STATDOPTS=\).*/\1"--port 32765 --outgoing-port 32766"/' /etc/default/nfs-common \
|
RUN sed -i 's/\(^STATDOPTS=\).*/\1"--port 32765 --outgoing-port 32766"/' /etc/default/nfs-common \
|
||||||
&& sed -i 's/\(^RPCMOUNTDOPTS=\).*/\1"--port 32767"/' /etc/default/nfs-kernel-server
|
&& sed -i 's/\(^RPCMOUNTDOPTS=\).*/\1"--port 32767"/' /etc/default/nfs-kernel-server
|
||||||
|
|
|
||||||
|
|
@ -11,14 +11,15 @@
|
||||||
mkdir -p $SRC/{output,userpatches}
|
mkdir -p $SRC/{output,userpatches}
|
||||||
grep -q '^docker:' /etc/group && chgrp --quiet docker $SRC/{output,userpatches}
|
grep -q '^docker:' /etc/group && chgrp --quiet docker $SRC/{output,userpatches}
|
||||||
chmod --quiet g+w,g+s $SRC/{output,userpatches}
|
chmod --quiet g+w,g+s $SRC/{output,userpatches}
|
||||||
VERSION=$(cat $SRC/VERSION)
|
VERSION=latest
|
||||||
if grep -q $VERSION <(grep armbian <(docker images)); then
|
|
||||||
display_alert "Using existed a armbian Docker container"
|
if grep -q $VERSION <(grep orangepi <(docker images)); then
|
||||||
|
display_alert "Using existed a orangepi Docker container"
|
||||||
else
|
else
|
||||||
# build a new container based on provided Dockerfile
|
# build a new container based on provided Dockerfile
|
||||||
display_alert "Docker container not found or out of date"
|
display_alert "Docker container not found or out of date"
|
||||||
display_alert "Building a Docker container"
|
display_alert "Building a Docker container"
|
||||||
if ! docker build -t armbian:$VERSION . ; then
|
if ! docker build -t orangepi:$VERSION . ; then
|
||||||
STATUS=$?
|
STATUS=$?
|
||||||
# Adding a newline, so the alert won't be shown in the same line as the error
|
# Adding a newline, so the alert won't be shown in the same line as the error
|
||||||
echo
|
echo
|
||||||
|
|
@ -77,10 +78,10 @@ fi
|
||||||
#DOCKER_FLAGS+=(-v /dev/bus/usb:/dev/bus/usb:ro)
|
#DOCKER_FLAGS+=(-v /dev/bus/usb:/dev/bus/usb:ro)
|
||||||
|
|
||||||
# map source to Docker Working dir.
|
# map source to Docker Working dir.
|
||||||
DOCKER_FLAGS+=(-v=$SRC/:/root/armbian/)
|
DOCKER_FLAGS+=(-v=$SRC/:/root/orangepi/)
|
||||||
|
|
||||||
# mount 2 named volumes - for cacheable data and compiler cache
|
# mount 2 named volumes - for cacheable data and compiler cache
|
||||||
DOCKER_FLAGS+=(-v=armbian-cache:/root/armbian/cache -v=armbian-ccache:/root/.ccache)
|
DOCKER_FLAGS+=(-v=orangepi-cache:/root/orangepi/cache -v=orangepi-ccache:/root/.ccache)
|
||||||
|
|
||||||
DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`")
|
DOCKER_FLAGS+=(-e COLUMNS="`tput cols`" -e LINES="`tput lines`")
|
||||||
|
|
||||||
|
|
@ -106,10 +107,10 @@ If you prefer to use profile, for example, `userpatches/config-my.conf`, try:
|
||||||
./compile.sh my compile_uboot
|
./compile.sh my compile_uboot
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
docker run "${DOCKER_FLAGS[@]}" -it --entrypoint /usr/bin/env armbian:$VERSION "$@" /bin/bash
|
docker run "${DOCKER_FLAGS[@]}" -it --entrypoint /usr/bin/env orangepi:$VERSION "$@" /bin/bash
|
||||||
else
|
else
|
||||||
display_alert "Running the container" "" "info"
|
display_alert "Running the container" "" "info"
|
||||||
docker run "${DOCKER_FLAGS[@]}" -it armbian:$VERSION "$@"
|
docker run "${DOCKER_FLAGS[@]}" -it orangepi:$VERSION "$@"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Docker error treatment
|
# Docker error treatment
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue