Merge pull request #9 from pressta/Dockerfile

Add Docker Scripts
This commit is contained in:
Paul Guenette
2020-03-09 21:09:18 -04:00
committed by GitHub
3 changed files with 70 additions and 0 deletions
+1
View File
@@ -23,6 +23,7 @@ Please add a note of your changes below this heading if you make a Pull Request.
* Unit Testing with Doctest has been started for select algorithms, see [Firmware/Tests/test_runner.cpp](Firmware/Tests/test_runner.cpp)
* Added support for Flylint VSCode Extension for static code analysis
* Using an STM32F405 .svd file allows CortexDebug to view registers during debugging
* Added scripts for building via docker.
### Changed
* Changed ratiometric `motor.config.current_lim_tolerance` to absolute `motor.config.current_lim_margin`
+22
View File
@@ -0,0 +1,22 @@
FROM ubuntu:bionic
# Prepare the build environment and dependencies
RUN apt-get update
RUN apt-get -y install software-properties-common
RUN add-apt-repository ppa:team-gcc-arm-embedded/ppa
RUN add-apt-repository ppa:jonathonf/tup
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get -y install gcc-arm-embedded openocd tup python3.7 build-essential git
# Build step below does not know about debian's python naming schemme
RUN ln -s /usr/bin/python3.7 /usr/bin/python
# Copy the firmware tree into the container
RUN mkdir ODrive
COPY . ODrive
WORKDIR ODrive/Firmware
# Hack around Tup's dependency on FUSE
RUN tup generate build.sh
RUN ./build.sh
Executable
+47
View File
@@ -0,0 +1,47 @@
function cleanup {
echo "Removing previous build artifacts"
rm -rf build
docker rm odrive-build-cont
}
function gc {
cleanup
docker rmi odrive-build-img
docker image prune
}
function build {
cleanup
echo "Building the firmware"
docker build -t odrive-build-img .
echo "Create container"
docker create --name odrive-build-cont odrive-build-img:latest
echo "Extract build artifacts"
docker cp odrive-build-cont:ODrive/Firmware/build .
}
function usage {
echo "usage: $0 (build | cleanup | gc)"
echo
echo "build -- build in docker and extract the artifacts."
echo "cleanup -- remove build artifacts from previous build"
echo "gc -- remove all build images and containers"
}
case $1 in
build)
build
;;
cleanup)
cleanup
;;
gc)
gc
;;
*)
usage
;;
esac