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

Docker support #53

Open
wants to merge 9 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
100 changes: 100 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
FROM ubuntu:20.04

ENV PYTHONUNBUFFERED 1
ENV DEBIAN_FRONTEND="noninteractive"

RUN apt-get update && \
apt-get install -y --no-install-recommends \
sudo \
ssh \
tzdata \
locales \
git \
nano \
clang \
libzmq3-dev \
libjson11-1 \
libjson11-1-dev \
liblmdb-dev \
libusb-1.0-0-dev \
gcc-arm-none-eabi \
libcurl4-openssl-dev \
libssl-dev \
ffmpeg \
libeigen3-dev \
software-properties-common \
openjdk-11-jdk \
python3.9 \
python3.9-dev \
python3.9-distutils \
python3-pip \
wget \
unzip \
make \
libssl-dev \
gcc \
autoconf \
automake \
libtool \
g++ \
tmux \
scons

RUN yes | sudo add-apt-repository ppa:ubuntu-toolchain-r/test
RUN apt upgrade libstdc++6 -y

RUN apt remove locales -y
RUN wget http://launchpadlibrarian.net/560614488/libc6_2.34-0ubuntu3_amd64.deb
RUN dpkg -i libc6_2.34-0ubuntu3_amd64.deb
RUN rm -rf libc6_2.34-0ubuntu3_amd64.deb

RUN mkdir -p /Android/Sdk/cmdline-tools/latest
RUN wget -q --show-progress --no-clobber --tries=5 https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip
RUN unzip commandlinetools-linux-8092744_latest.zip
RUN mv cmdline-tools/* /Android/Sdk/cmdline-tools/latest/
RUN rm -rf cmdline-tools commandlinetools-linux-8092744_latest.zip
RUN echo 'export ANDROID_SDK_ROOT=/Android/Sdk'
RUN echo 'export PATH=$PATH:/Android/Sdk/cmdline-tools/latest/bin'
RUN alias sdkmanager=/Android/Sdk/cmdline-tools/latest/bin/sdkmanager
RUN yes | /Android/Sdk/cmdline-tools/latest/bin/sdkmanager --licenses
RUN /Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "platform-tools"
RUN /Android/Sdk/cmdline-tools/latest/bin/sdkmanager --install "build-tools;32.0.0"
RUN yes | sudo add-apt-repository ppa:deadsnakes/ppa

WORKDIR /tmp
RUN git clone https://github.com/capnproto/capnproto.git
WORKDIR /tmp/capnproto
RUN git checkout tags/v0.8.0
WORKDIR /tmp/capnproto/c++
RUN autoreconf -i
RUN ./configure
RUN make -j6 check
RUN sudo make install

RUN python3.9 -m pip install \
pipenv \
numpy \
pycryptodome
RUN pipenv --python 3.9

COPY . /flowpilot

WORKDIR /flowpilot/libs/capnpc-java
RUN \
if [ ! -d capnproto-java/ ]; \
then \
git clone https://github.com/capnproto/capnproto-java.git $DIR/capnproto-java; \
fi
WORKDIR /flowpilot/libs/capnpc-java/capnproto-java
RUN git checkout 81d18463a8f3c98f6d21d4eae27caaca6bace4f7
RUN make
RUN sudo make install

WORKDIR /flowpilot
RUN pipenv run pip install pkgconfig==1.5.5 Cython==0.29.32
RUN pipenv run pip install pycapnp==1.0.0
RUN pipenv run pip install -r requirements.txt
RUN touch .deb_update
RUN pipenv run scons
ENV ANDROID_SDK_ROOT=/Android/Sdk
RUN ./gradlew desktop:assemble
4 changes: 2 additions & 2 deletions SConscript
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ gen_setup_files = [

env.Command(['.env'], ['flowpilot_env.sh'], './flowpilot_env.sh')
env.Command([gen_setup_files], ['setup.py'], 'pip install -e .')
env.Command('.dep_update', ['get_dependencies.sh'], './get_dependencies.sh')
env.Command('.pip_update', ['requirements.txt'], 'pip install -r requirements.txt && touch .pip_update')
# env.Command('.dep_update', ['get_dependencies.sh'], './get_dependencies.sh')
# env.Command('.pip_update', ['requirements.txt'], 'pip install -r requirements.txt && touch .pip_update')
10 changes: 5 additions & 5 deletions launch_flowpilot.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
set -e
source ./.env
. ./.env

export WIDE_ROAD_CAMERA_SOURCE="selfdrive/assets/fcam.avi" # no affect on android
export ROAD_CAMERA_SOURCE="selfdrive/assets/tmp" # no affect on android
Expand All @@ -12,13 +12,12 @@ export ZMQ_MESSAGING_PROTOCOL="TCP" # TCP, INTER_PROCESS, SHARED_MEMORY
#export DISCOVERABLE_PUBLISHERS="1" # if enabled, other devices on same network can access sup/pub data.
#export DEVICE_ADDR="127.0.0.1" # connect to external device running flowpilot over same network. useful for livestreaming.

export SIMULATION="1"
#export FINGERPRINT="HONDA CIVIC 2016"
export SIMULATION="0"
export FINGERPRINT="HONDA CIVIC 2016"

## android specific ##
export USE_SNPE="0" # only works for snapdragon devices.


if ! command -v tmux &> /dev/null
then
echo "tmux could not be found, installing.."
Expand All @@ -38,4 +37,5 @@ if pgrep -x "flowinit" > /dev/null
tmux attach -t flowpilot
fi

while true; do sleep 1; done
# while true; do sleep 1; done
scons && flowinit
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ smbus2==0.4.2
pycurl==7.45.1
tenacity==8.0.1
atomicwrites==1.4.0
sentry-sdk==1.10.1
sentry-sdk==1.19.1
sympy==1.11.1
certifi==2022.12.7
hatanaka==2.8.0
boto3==1.26.113
inputs==0.5
inputs==0.5
7 changes: 7 additions & 0 deletions run_docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
xhost + > /dev/null
docker run -it --rm \
-e DISPLAY:$DISPLAY \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \
--device=/dev/dri:/dev/dri \
--mount type=volume,src=flowdrive,target=/root/.flowdrive \
raghav66/flowpilot:latest
41 changes: 31 additions & 10 deletions scripts/install-flowpilot-desktop
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,28 @@ fail() {
# install android and java sdk
sudo apt update
sudo apt install -y openjdk-11-jdk git
wget -q --show-progress --no-clobber --tries=5 https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip
unzip commandlinetools-linux-8092744_latest.zip
mkdir -p ~/Android/Sdk/cmdline-tools/latest
mv cmdline-tools/* ~/Android/Sdk/cmdline-tools/latest/
rm -rf cmdline-tools

if ! [ -e ./commandlinetools-linux-8092744_latest.zip ]; then
wget -q --show-progress --no-clobber --tries=5 https://dl.google.com/android/repository/commandlinetools-linux-8092744_latest.zip
unzip commandlinetools-linux-8092744_latest.zip
else
info "Skipping Command Line tools download as it is already downloaded."
fi

if ! [ -e ~/Android ]; then
mkdir -p ~/Android/Sdk/cmdline-tools/latest
mv cmdline-tools/* ~/Android/Sdk/cmdline-tools/latest/
rm -rf cmdline-tools
else
info "Skipping Android SDK installation, ~/Android already exists"
fi

echo 'export ANDROID_SDK_ROOT=$HOME/Android/Sdk' >> ~/.bashrc
echo 'export PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin' >> ~/.bashrc

export ANDROID_SDK_ROOT=$HOME/Android/Sdk
export PATH=$PATH:$HOME/Android/Sdk/cmdline-tools/latest/bin

yes | sdkmanager --licenses
sdkmanager --install "platform-tools"
sdkmanager --install "build-tools;32.0.0"
Expand All @@ -46,11 +59,19 @@ yes | sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install -y python3.9 python3.9-dev python3.9-distutils python3-pip scons

# get flowpilot
cd ~/ && git clone https://github.com/flowdriveai/flowpilot.git
cd flowpilot && git submodule update --init

pip install pipenv numpy pycryptodome
if ! [ -e ~/flowpilot ]; then
cd ~/ && git clone https://github.com/flowdriveai/flowpilot.git
cd flowpilot && git submodule update --init
python3.9 -m pip install pipenv
python3.9 -m pipenv shell
./get_dependencies.sh
./flowpilot_env.sh

source ~/.bashrc
else
cd ~/flowpilot && git pull origin master && git submodule update --init
./get_dependencies.sh
./flowpilot_env.sh
fi

success "Flowpilot successfully installed."
success "Flowpilot successfully installed."