Skip to content

Commit e8d069e

Browse files
committed
Adding cloud build docker files.
# Conflicts: # LICENSE
1 parent 8eddf5e commit e8d069e

File tree

7 files changed

+151
-7
lines changed

7 files changed

+151
-7
lines changed

.gitignore

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#Ignore thumbnails created by Windows
2+
Thumbs.db
3+
#Ignore files built by Visual Studio
4+
*.obj
5+
*.exe
6+
*.pdb
7+
*.user
8+
*.aps
9+
*.pch
10+
*.vspscc
11+
*_i.c
12+
*_p.c
13+
*.ncb
14+
*.suo
15+
*.tlb
16+
*.tlh
17+
*.bak
18+
*.cache
19+
*.ilk
20+
*.log
21+
[Bb]in
22+
[Dd]ebug*/
23+
*.lib
24+
*.sbr
25+
obj/
26+
[Rr]elease*/
27+
_ReSharper*/
28+
[Tt]est[Rr]esult*
29+
.vs/
30+
#Nuget packages folder
31+
packages/

LICENSE

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
GNU GENERAL PUBLIC LICENSE
22
Version 3, 29 June 2007
33

4-
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
4+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
55
Everyone is permitted to copy and distribute verbatim copies
66
of this license document, but changing it is not allowed.
77

@@ -631,8 +631,8 @@ to attach them to the start of each source file to most effectively
631631
state the exclusion of warranty; and each file should have at least
632632
the "copyright" line and a pointer to where the full notice is found.
633633

634-
<one line to give the program's name and a brief idea of what it does.>
635-
Copyright (C) <year> <name of author>
634+
{one line to give the program's name and a brief idea of what it does.}
635+
Copyright (C) {year} {name of author}
636636

637637
This program is free software: you can redistribute it and/or modify
638638
it under the terms of the GNU General Public License as published by
@@ -645,14 +645,14 @@ the "copyright" line and a pointer to where the full notice is found.
645645
GNU General Public License for more details.
646646

647647
You should have received a copy of the GNU General Public License
648-
along with this program. If not, see <https://www.gnu.org/licenses/>.
648+
along with this program. If not, see <http://www.gnu.org/licenses/>.
649649

650650
Also add information on how to contact you by electronic and paper mail.
651651

652652
If the program does terminal interaction, make it output a short
653653
notice like this when it starts in an interactive mode:
654654

655-
<program> Copyright (C) <year> <name of author>
655+
{project} Copyright (C) {year} {fullname}
656656
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657657
This is free software, and you are welcome to redistribute it
658658
under certain conditions; type `show c' for details.
@@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
664664
You should also get your employer (if you work as a programmer) or school,
665665
if any, to sign a "copyright disclaimer" for the program, if necessary.
666666
For more information on this, and how to apply and follow the GNU GPL, see
667-
<https://www.gnu.org/licenses/>.
667+
<http://www.gnu.org/licenses/>.
668668

669669
The GNU General Public License does not permit incorporating your program
670670
into proprietary programs. If your program is a subroutine library, you
671671
may consider it more useful to permit linking proprietary applications with
672672
the library. If this is what you want to do, use the GNU Lesser General
673673
Public License instead of this License. But first, please read
674-
<https://www.gnu.org/licenses/why-not-lgpl.html>.
674+
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

README.md

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Docker Betaflight Cloud Build
2+
[![Docker Pulls](https://img.shields.io/docker/pulls/betaflight/cloudbuild.svg)](https://hub.docker.com/r/betaflight/cloudbuild/) [![Docker Stars](https://img.shields.io/docker/stars/betaflight/cloudbuild.svg)](https://hub.docker.com/r/betaflight/cloudbuild/) [![License](https://img.shields.io/badge/license-GPL--3.0-blue.svg?style=flat)](https://github.com/betaflight/cloudbuild/blob/master/LICENSE)
3+
4+
_(Markdown optimised for display in [Dockerhub](https://hub.docker.com/r/betaflight/cloudbuild).)_
5+
6+
Clone and edit [Betaflight](https://github.com/betaflight/betaflight) locally on your platform. This image will take it from there and turn your code into a binary which you then can flash to your flight controller with the [Betaflight Configurator](https://github.com/betaflight/betaflight-configurator).
7+
8+
## Usage
9+
### Install Docker
10+
The latest docker platform is available from [https://www.docker.com/](https://www.docker.com/products/overview#/install_the_platform). If your system does not meet the system requirements for the latest version, check out the [Docker Toolbox](https://www.docker.com/products/docker-toolbox).
11+

build/Dockerfile

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
FROM betaflight/cloudbuild:ARM10.3
2+
3+
ARG COMMIT="master"
4+
ARG REPO="https://github.com/betaflight/betaflight.git"
5+
6+
RUN echo "$REPO $COMMIT"
7+
8+
RUN git clone -b ${COMMIT} ${REPO} source
9+
10+
WORKDIR /source
11+
12+
RUN git checkout ${COMMIT}
13+
14+
ARG NOCACHE="1"
15+
16+
RUN git pull origin ${COMMIT}:${COMMIT}
17+
18+
WORKDIR /build
19+
COPY build.sh .

build/Dockerfile-ARM10.3

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM ubuntu
2+
3+
RUN apt update \
4+
&& apt -y install git make curl bzip2 apt-utils xxd \
5+
&& rm -rf /var/lib/apt/lists/*
6+
7+
RUN git config --global advice.detachedHead false
8+
9+
ARG DL_DIR="/download"
10+
ARG TOOLS_DIR="/tools"
11+
ARG ARM_SDK_DIR="${TOOLS_DIR}/gcc-arm-none-eabi-10.3-2021.10"
12+
ARG ARM_SDK_FILE="gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2"
13+
ARG ARM_SDK_URL="https://developer.arm.com/-/media/Files/downloads/gnu-rm/10.3-2021.10/${ARM_SDK_FILE}"
14+
15+
RUN mkdir -p /tools
16+
RUN mkdir -p ${DL_DIR}
17+
18+
RUN curl -L -k -o "${DL_DIR}/${ARM_SDK_FILE}" "${ARM_SDK_URL}"
19+
20+
RUN tar -C ${TOOLS_DIR} -xjf "${DL_DIR}/${ARM_SDK_FILE}"
21+
22+
ENV PATH="${PATH}:${ARM_SDK_DIR}/bin"
23+
24+
RUN rm "${DL_DIR}/${ARM_SDK_FILE}"
25+
26+
RUN ${ARM_SDK_DIR}/bin/arm-none-eabi-gcc -dumpversion

build/build-container.sh

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
3+
BRANCH=$1
4+
TAG=$2
5+
REPO=$3
6+
7+
if [ -z "$BRANCH" ]; then
8+
BRANCH="master"
9+
fi
10+
11+
if [ -z "$TAG" ]; then
12+
TAG=${BRANCH}
13+
fi
14+
15+
if [ -z "$REPO" ]; then
16+
REPO="https://github.com/betaflight/betaflight.git"
17+
fi
18+
19+
echo "using ${TAG} -> ${BRANCH} (${REPO})"
20+
21+
docker build ./build -f build/Dockerfile --tag "betaflight/cloudbuild:${TAG}" --build-arg NOCACHE=$(date +%s) --build-arg COMMIT=${BRANCH} --build-arg REPO=${REPO}

build/build.sh

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/bash
2+
3+
COMMIT=$1
4+
TARGET=$2
5+
FLAGS=$3
6+
7+
echo ""
8+
echo "Pulling from Github (${COMMIT}):"
9+
10+
cd /source
11+
git fetch origin "${COMMIT}":CLOUD_HEAD || { echo "fetch failed with $?"; exit 1; }
12+
[ $? == 1 ] && exit 0;
13+
14+
echo ""
15+
echo "Checking out the branch -> CLOUD_HEAD (for ${COMMIT})"
16+
17+
cd /source
18+
git checkout -f CLOUD_HEAD || { echo "checkout failed with $?"; exit 1; }
19+
[ $? == 1 ] && exit 0;
20+
21+
echo ""
22+
echo "Commencing the build (make ${TARGET}):"
23+
24+
cd /source
25+
make $TARGET EXTRA_FLAGS="${FLAGS}" || { echo "make failed with $?"; exit 1; }
26+
[ $? == 1 ] && exit 0;
27+
28+
echo ""
29+
30+
if [[ -d "/output" ]] ; then
31+
echo "Copying hex files (to output):"
32+
cp -v /source/obj/*.hex /output
33+
echo " -> completed"
34+
else
35+
echo "Skipping copying hex files (no output mount for container)"
36+
fi

0 commit comments

Comments
 (0)