forked from betaflight/docker-betaflight-build
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
45 lines (38 loc) · 1.73 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
FROM ubuntu:16.04
MAINTAINER betaflight
# If you want to tinker with this Dockerfile on your machine do as follows:
# - git clone https://github.com/betaflight/docker-betaflight-build.git
# - vim docker-betaflight-build/Dockerfile
# - docker build -t betaflight-build docker-betaflight-build
# - cd <your betaflight source dir>
# - docker run --rm -ti -v `pwd`:/opt/betaflight betaflight-build
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y full-upgrade
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install software-properties-common git make ccache python curl bzip2 gcc
RUN DEBIAN_FRONTEND=noninteractive add-apt-repository -y ppa:team-gcc-arm-embedded/ppa
RUN DEBIAN_FRONTEND=noninteractive apt-get -y update
RUN DEBIAN_FRONTEND=noninteractive apt-get -y install gcc-arm-embedded
RUN mkdir -p /opt
RUN mkdir -p /opt/betaflight
WORKDIR /opt/betaflight
ENV ARM_SDK_DIR="/usr/"
# Config options you may pass via Docker like so 'docker run -e "<option>=<value>"':
# - PLATFORM=<name>, specify target platform to build for
# Specify 'ALL' to build for all supported platforms. (default: NAZE)
# - OPTIONS=<options> specify build options to be used as defines during the build
#
# What the commands do:
CMD if [ -z ${PLATFORM} ]; then \
PLATFORM="NAZE"; \
fi && \
EXTRA_OPTIONS="" && \
if [ -n ${OPTIONS} ]; then \
EXTRA_OPTIONS="OPTIONS=${OPTIONS}"; \
fi && \
if [ ${PLATFORM} = ALL ]; then \
make ARM_SDK_DIR=${ARM_SDK_DIR} clean_all && \
make ARM_SDK_DIR=${ARM_SDK_DIR} all ${EXTRA_OPTIONS}; \
else \
make ARM_SDK_DIR=${ARM_SDK_DIR} clean TARGET=${PLATFORM} && \
make ARM_SDK_DIR=${ARM_SDK_DIR} TARGET=${PLATFORM} ${EXTRA_OPTIONS}; \
fi