-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add docker file for adrupilot simulator
- Loading branch information
Showing
1 changed file
with
69 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
ARG BASE_IMAGE="ubuntu" | ||
ARG TAG="22.04" | ||
FROM ${BASE_IMAGE}:${TAG} | ||
WORKDIR /ardupilot | ||
|
||
ARG DEBIAN_FRONTEND=noninteractive | ||
ARG USER_NAME=ardupilot | ||
ARG USER_UID=1000 | ||
ARG USER_GID=1000 | ||
ARG SKIP_AP_EXT_ENV=1 | ||
ARG SKIP_AP_GRAPHIC_ENV=1 | ||
ARG SKIP_AP_COV_ENV=1 | ||
ARG SKIP_AP_GIT_CHECK=1 | ||
|
||
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 \ | ||
lsb-release \ | ||
sudo \ | ||
tzdata \ | ||
bash-completion \ | ||
git && apt-get install --reinstall -y ca-certificates && update-ca-certificates | ||
|
||
RUN git clone https://github.com/ArduPilot/ardupilot.git . && /ardupilot/Tools/gittools/submodule-sync.sh | ||
|
||
#COPY Tools/environment_install/install-prereqs-ubuntu.sh /ardupilot/Tools/environment_install/ | ||
#COPY Tools/completion /ardupilot/Tools/completion/ | ||
|
||
# Create non root user for pip | ||
ENV USER=${USER_NAME} | ||
|
||
RUN echo "ardupilot 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} | ||
|
||
ENV SKIP_AP_EXT_ENV=$SKIP_AP_EXT_ENV SKIP_AP_GRAPHIC_ENV=$SKIP_AP_GRAPHIC_ENV SKIP_AP_COV_ENV=$SKIP_AP_COV_ENV SKIP_AP_GIT_CHECK=$SKIP_AP_GIT_CHECK | ||
RUN Tools/environment_install/install-prereqs-ubuntu.sh -y | ||
|
||
# add waf alias to ardupilot waf to .ardupilot_env | ||
RUN echo "alias waf=\"/${USER_NAME}/waf\"" >> ~/.ardupilot_env | ||
|
||
# Check that local/bin are in PATH for pip --user installed package | ||
RUN echo "if [ -d \"\$HOME/.local/bin\" ] ; then\nPATH=\"\$HOME/.local/bin:\$PATH\"\nfi" >> ~/.ardupilot_env | ||
|
||
# Create entrypoint as docker cannot do shell substitution correctly | ||
RUN export ARDUPILOT_ENTRYPOINT="/home/${USER_NAME}/ardupilot_entrypoint.sh" \ | ||
&& echo "#!/bin/bash" > $ARDUPILOT_ENTRYPOINT \ | ||
&& echo "set -e" >> $ARDUPILOT_ENTRYPOINT \ | ||
&& echo "source /home/${USER_NAME}/.ardupilot_env" >> $ARDUPILOT_ENTRYPOINT \ | ||
&& echo 'exec "$@"' >> $ARDUPILOT_ENTRYPOINT \ | ||
&& chmod +x $ARDUPILOT_ENTRYPOINT \ | ||
&& sudo mv $ARDUPILOT_ENTRYPOINT /ardupilot_entrypoint.sh | ||
|
||
RUN /ardupilot/waf configure && /ardupilot/modules/waf/waf-light build --target bin/ardurover | ||
|
||
# Set the buildlogs directory into /tmp as other directory aren't accessible | ||
ENV BUILDLOGS=/tmp/buildlogs | ||
|
||
# Cleanup | ||
RUN sudo apt-get clean \ | ||
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | ||
|
||
ENV CCACHE_MAXSIZE=1G | ||
ENTRYPOINT ["/ardupilot_entrypoint.sh"] | ||
CMD ["bash"] |