duckietown / duckietown-shell-commands

Commands for the Duckietown Shell
4 stars 2 forks source link

Create command line argument to specify custom base agent Docker Images #327

Closed GreatGameDota closed 1 year ago

GreatGameDota commented 2 years ago

This is the first step to being able to run custom images on a physical Duckiebot for more complex exercises. Assuming the specified image has already been built on the Duckiebot, and assuming the built image has the same base architecture as the Duckiebot, this will run the same as the premade Docker images available on the Docker hub.

This code can be further expanded to give options for building images through the duckietown shell, perhaps through the build command. Example code below is the needed code for the Dockerfile in order to properly build an image on a physical Duckiebot.

ARG ARCH=arm64v8
ARG MAJOR=daffy
ARG BASE_TAG=${MAJOR}-${ARCH}

FROM docker.io/duckietown/challenge-aido_lf-baseline-duckietown:${BASE_TAG}

ARG PIP_INDEX_URL="https://pypi.org/simple"
ENV PIP_INDEX_URL=${PIP_INDEX_URL}
WORKDIR /agent

COPY requirements.* ./
RUN cat requirements.* > .requirements.txt
RUN echo PIP_INDEX_URL=$PIP_INDEX_URL
RUN python3 -m pip install  -r .requirements.txt

For now users would have to ssh onto the Duckiebot, rsync over the Dockerfile and requirements.txt files and manually call docker build. Notice the arm64v8 is the same architecture as the Dockiebot. This code will properly install new pip packages from a given requirements.txt which is required for complex exercises, for example the object detection exercises using Yolov5.

Note: This pull request also contains code from a previous pull request found here.

afdaniele commented 1 year ago

This was integrated into dts, thanks for contributing.