summaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorJean-François Milants <jf@codingfield.com>2022-05-15 10:50:12 +0200
committerJF <JF002@users.noreply.github.com>2022-05-26 11:35:25 +0200
commit831f93cd92e91a974f03cf0a739982103246e275 (patch)
tree9e7d6d95e271403c20b58344f2421f28b9d2c8c8 /docker
parent34506be06e66d2996afb7cd432535c15d0d3561f (diff)
The main build workflow for GitHub Actions now uses the infinitime-build docker image to build the firmware. This allows to avoid the duplication of the build logic in Docker and Github workflow format.
The Dockerfile has been slightly adapted (remove the USER instructions). Docker images are now published in DockerHub (jf002/infinitime-build).
Diffstat (limited to 'docker')
-rw-r--r--docker/Dockerfile5
-rwxr-xr-xdocker/build.sh16
-rwxr-xr-xdocker/post_build.sh.in10
3 files changed, 10 insertions, 21 deletions
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 10bed55f..f2d187d0 100644
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -44,10 +44,5 @@ RUN bash -c "source /opt/build.sh; GetNrfSdk;"
# McuBoot
RUN bash -c "source /opt/build.sh; GetMcuBoot;"
-ARG PUID=1000
-ARG PGID=1000
-RUN groupadd --system --gid $PGID infinitime && useradd --system --uid $PUID --gid $PGID infinitime
-
-USER infinitime:infinitime
ENV SOURCES_DIR /sources
CMD ["/opt/build.sh"]
diff --git a/docker/build.sh b/docker/build.sh
index d86e7c21..878d9ec6 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -9,7 +9,7 @@ set -e
export TOOLS_DIR="${TOOLS_DIR:=/opt}"
export SOURCES_DIR="${SOURCES_DIR:=/sources}"
export BUILD_DIR="${BUILD_DIR:=$SOURCES_DIR/build}"
-export OUTPUT_DIR="${OUTPUT_DIR:=$BUILD_DIR/output}"
+export OUTPUT_DIR="${OUTPUT_DIR:=$SOURCES_DIR/build/output}"
export BUILD_TYPE=${BUILD_TYPE:=Release}
export GCC_ARM_VER=${GCC_ARM_VER:="gcc-arm-none-eabi-9-2020-q2-update"}
@@ -22,7 +22,7 @@ main() {
local target="$1"
mkdir -p "$TOOLS_DIR"
-
+
[[ ! -d "$TOOLS_DIR/$GCC_ARM_VER" ]] && GetGcc
[[ ! -d "$TOOLS_DIR/$NRF_SDK_VER" ]] && GetNrfSdk
[[ ! -d "$TOOLS_DIR/mcuboot" ]] && GetMcuBoot
@@ -31,7 +31,7 @@ main() {
CmakeGenerate
CmakeBuild $target
- BUILD_RESULT=$?
+ BUILD_RESULT=$?
if [ "$DISABLE_POSTBUILD" != "true" -a "$BUILD_RESULT" == 0 ]; then
source "$BUILD_DIR/post_build.sh"
fi
@@ -54,18 +54,14 @@ GetNrfSdk() {
}
CmakeGenerate() {
- # We can swap the CD and trailing SOURCES_DIR for -B and -S respectively
- # once we go to newer CMake (Ubuntu 18.10 gives us CMake 3.10)
- cd "$BUILD_DIR"
-
cmake -G "Unix Makefiles" \
+ -S "$SOURCES_DIR" \
+ -B "$BUILD_DIR" \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DUSE_OPENOCD=1 \
-DARM_NONE_EABI_TOOLCHAIN_PATH="$TOOLS_DIR/$GCC_ARM_VER" \
-DNRF5_SDK_PATH="$TOOLS_DIR/$NRF_SDK_VER" \
- -DBUILD_DFU=1 \
- "$SOURCES_DIR"
- cmake -L -N .
+ -DBUILD_DFU=1
}
CmakeBuild() {
diff --git a/docker/post_build.sh.in b/docker/post_build.sh.in
index db6e7a94..8c94471a 100755
--- a/docker/post_build.sh.in
+++ b/docker/post_build.sh.in
@@ -15,12 +15,10 @@ cp "$BUILD_DIR/src/pinetime-mcuboot-app-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/p
cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-image-$PROJECT_VERSION.bin"
cp "$BUILD_DIR/src/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip" "$OUTPUT_DIR/pinetime-mcuboot-recovery-loader-dfu-$PROJECT_VERSION.zip"
-
mkdir -p "$OUTPUT_DIR/src"
-cd "$BUILD_DIR"
-cp src/*.bin "$OUTPUT_DIR/src"
-cp src/*.hex "$OUTPUT_DIR/src"
-cp src/*.out "$OUTPUT_DIR/src"
-cp src/*.map "$OUTPUT_DIR/src"
+cp $BUILD_DIR/src/*.bin "$OUTPUT_DIR/src/"
+cp $BUILD_DIR/src/*.hex "$OUTPUT_DIR/src/"
+cp $BUILD_DIR/src/*.out "$OUTPUT_DIR/src/"
+cp $BUILD_DIR/src/*.map "$OUTPUT_DIR/src/"
ls -RUv1 "$OUTPUT_DIR" | sed 's;^\([^/]\); \1;g' \ No newline at end of file