Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add build in Docker #332

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
ARG BASE_IMAGE="ubuntu"
# ARG TAG="18.04"
ARG TAG="22.04"
FROM ${BASE_IMAGE}:${TAG}
WORKDIR /vesc_tool

ARG DEBIAN_FRONTEND=noninteractive
ARG USER_NAME=vesc_tool
ARG USER_UID=1000
ARG USER_GID=1000

RUN groupadd ${USER_NAME} --gid ${USER_GID}\
&& useradd -l -m ${USER_NAME} -u ${USER_UID} -g ${USER_GID} -s /bin/bash

RUN apt-get update && apt-get install --no-install-recommends -y \
sudo \
bash-completion \
python3 python-is-python3 perl git openssl libssl-dev\
wget curl iputils-ping build-essential \
make ca-certificates xz-utils bzip2 zip \
# libqt5printsupport5 libqt5quickwidgets5 libqt5gamepad5 libqt5serialport5 \
# libqt5bluetooth5 libqt5positioning5 libqt5bluetooth5 libqt5widgets5 qml-module-qtquick-controls \
# qml-module-qtquick-controls2 qml-module-qtquick-extras qml-module-qt-labs-settings \
# qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools \
# libdrm-dev libgles2-mesa-dev \
# libxcb-xinerama0-dev "^libxcb.*" \
# libx11-xcb-dev libglu1-mesa-dev libxrender-dev libxi-dev \
# flex bison gperf libicu-dev libxslt-dev ruby libssl-dev \
# libxcursor-dev libxcomposite-dev libxdamage-dev libxrandr-dev \
# libfontconfig1-dev libcap-dev libxtst-dev libpulse-dev libudev-dev \
# libpci-dev libnss3-dev libasound2-dev libxss-dev libegl1-mesa-dev \
# gperf bison libbz2-dev libgcrypt20-dev libdrm-dev libcups2-dev \
# libatkmm-1.6-dev libasound2-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
# libbluetooth-dev bluetooth blueman bluez libusb-dev libdbus-1-dev bluez-hcidump \
# bluez-tools
qtbase5-private-dev qtscript5-dev \
qml-module-qt-labs-folderlistmodel qml-module-qtquick-extras \
qml-module-qtquick-controls2 qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5quickcontrols2-5 qtquickcontrols2-5-dev \
qtcreator qtcreator-doc libqt5serialport5-dev qml-module-qt3d qt3d5-dev \
qtdeclarative5-dev qtconnectivity5-dev qtmultimedia5-dev qtpositioning5-dev \
libqt5gamepad5-dev qml-module-qt-labs-settings qml-module-qt-labs-platform libqt5svg5-dev

ENV USER=${USER_NAME}

RUN echo "vesc_tool ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME}
RUN chmod 0440 /etc/sudoers.d/${USER_NAME}

RUN chown -R ${USER_NAME}:${USER_NAME} /${USER_NAME}

USER ${USER_NAME}

# RUN cd /opt \
# && sudo mkdir qt5 \
# && sudo chown $USER qt5 \
# && git clone https://code.qt.io/qt/qt5.git \
# && cd qt5 \
# && git checkout 5.15 \
# && perl init-repository --module-subset=default,-qtwebkit,-qtwebkit-examples,-qtwebengine

# RUN sudo mkdir /opt/qt5/build \
# && cd /opt/qt5/build \
# && sudo chown $USER /opt/qt5/build \
# && ../configure -prefix /opt/Qt/5.15-static/ -release -opensource -confirm-license \
# -static -no-sql-mysql -no-sql-psql -no-sql-sqlite -no-journald -qt-zlib -no-mtdev \
# -no-gif -qt-libpng -qt-libjpeg -qt-harfbuzz -qt-pcre -no-glib -no-compile-examples \
# -no-cups -no-iconv -no-tslib -dbus-linked \
# -no-xcb-xlib -no-eglfs -no-directfb -no-linuxfb -no-kms \
# -nomake examples -nomake tests -skip qtwebsockets -skip qtwebchannel \
# -skip qtwebengine -skip qtwayland -skip qtwinextras -skip qtsensors -skip multimedia \
# -no-libproxy -no-icu -qt-freetype -skip qtimageformats -opengl es2 \
# && make -j$(nproc) \
# && sudo make install

CMD ["bash"]
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,17 @@ If you have custom hardware and you want to add support for it in the official r
1) Go to https://github.com/vedderb/bldc and use the github fork function.
2) Make your changes, test them and make a pull request to the main repository.
3) If the pull request gets accepted your hardware will become part of the next official release. It will show up in the binary beta typically after a few days and in the stable version the next time a stable release is made.

## How to Build the Docker Image

### tested only Linux

docker build . -t vesc_tool

### run bach

docker run --rm -it -v `pwd`:/vesc_tool vesc_tool:latest bash

### or build in docker

docker run --rm -it -v `pwd`:/vesc_tool vesc_tool:latest /vesc_tool/build_lin
12 changes: 6 additions & 6 deletions build_lin
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ rm -rf build/lin/*
# Original
qmake -config release "CONFIG += release_lin build_original"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj
cd build/lin
zip vesc_tool_original_linux.zip `ls | grep -v '\.zip$'`
Expand All @@ -66,7 +66,7 @@ cd ../..
# Platinum
qmake -config release "CONFIG += release_lin build_platinum"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj
cd build/lin
zip vesc_tool_platinum_linux.zip `ls | grep -v '\.zip$'`
Expand All @@ -76,7 +76,7 @@ cd ../..
# Gold
qmake -config release "CONFIG += release_lin build_gold"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj
cd build/lin
zip vesc_tool_gold_linux.zip `ls | grep -v '\.zip$'`
Expand All @@ -86,7 +86,7 @@ cd ../..
# Silver
qmake -config release "CONFIG += release_lin build_silver"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj
cd build/lin
zip vesc_tool_silver_linux.zip `ls | grep -v '\.zip$'`
Expand All @@ -96,7 +96,7 @@ cd ../..
# Bronze
qmake -config release "CONFIG += release_lin build_bronze"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj
cd build/lin
zip vesc_tool_bronze_linux.zip `ls | grep -v '\.zip$'`
Expand All @@ -106,7 +106,7 @@ cd ../..
# Free of charge
qmake -config release "CONFIG += release_lin build_free"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj
cd build/lin
zip vesc_tool_free_linux.zip `ls | grep -v '\.zip$'`
Expand Down
2 changes: 1 addition & 1 deletion build_lin_original_only
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ rm -rf build/lin/*
# Original
qmake -config release "CONFIG += release_lin build_original"
make clean
make -j8
make -j$(nproc)
rm -rf build/lin/obj

1 change: 1 addition & 0 deletions vesc_tool.pro
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ release_win {
release_lin {
# http://micro.nicholaswilson.me.uk/post/31855915892/rules-of-static-linking-libstdc-libc-libgcc
# http://insanecoding.blogspot.se/2012/07/creating-portable-linux-binaries.html
CONFIG += exclude_fw
QMAKE_LFLAGS += -static-libstdc++ -static-libgcc
DESTDIR = build/lin
OBJECTS_DIR = build/lin/obj
Expand Down
Loading