Files
ODrive/Dockerfile
SZEDER Gábor e75f7455c4 Dockerfile: generate autogen/version.c only once
Since c5720564 (Force version to be regenerated on each compile,
2021-06-01) `autogen/version.c` must be generated during the build
process, but the build instructions in the `Dockerfile` have not been
updated accordingly.  Since then two commits [1] on separate branches
updated `Dockerfile` to deal with the missing file, and now
`autogen/version.c` is generated twice during a containerized build.

Remove all redundant commands from `Dockerfile`'s `CMD` instruction to
generate `autogen/version.c` and its subdirectory only once.

[1] 8e9745a6 (Add version.c generation to dockerbuild and actions,
              2021-11-02)
    7f013d6d (Fixed dockerbuild.sh, now run as user (instead
              of root) and fixed the autogeneration of version.c,
              2021-09-16)
2022-02-20 20:25:08 +01:00

38 lines
1.2 KiB
Docker

FROM ubuntu:bionic
# Prepare the build environment and dependencies
RUN \
set -x && \
apt-get update && \
apt-get -y install software-properties-common && \
add-apt-repository ppa:team-gcc-arm-embedded/ppa && \
add-apt-repository ppa:jonathonf/tup && \
apt-get update && \
apt-get -y upgrade && \
apt-get -y install gcc-arm-embedded openocd tup python3.7 python3-yaml python3-jinja2 python3-jsonschema build-essential git time && \
# Build step below does not know about debian's python naming schemme
ln -s /usr/bin/python3.7 /usr/bin/python && \
mkdir -p ODrive
WORKDIR ODrive/Firmware
# Must attach the firmware tree into the container
CMD \
# Regenerate autogen/version.c
mkdir -p autogen && \
python ../tools/odrive/version.py \
--output autogen/version.c && \
# Regenerate python interface
python interface_generator_stub.py \
--definitions odrive-interface.yaml \
--template ../tools/enums_template.j2 \
--output ../tools/odrive/enums.py && \
python interface_generator_stub.py \
--definitions odrive-interface.yaml \
--template ../tools/arduino_enums_template.j2 \
--output ../Arduino/ODriveArduino/ODriveEnums.h && \
# Hack around Tup's dependency on FUSE
tup init && \
tup generate build.sh && \
./build.sh