2023-08-09 17:44:51 -03:00
|
|
|
ARG BASE_IMAGE="ubuntu"
|
|
|
|
ARG TAG="22.04"
|
|
|
|
FROM ${BASE_IMAGE}:${TAG}
|
2017-11-17 14:29:47 -04:00
|
|
|
WORKDIR /ardupilot
|
|
|
|
|
2020-09-02 18:06:44 -03:00
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
2022-07-11 17:46:39 -03:00
|
|
|
ARG USER_NAME=ardupilot
|
|
|
|
ARG USER_UID=1000
|
|
|
|
ARG USER_GID=1000
|
2024-04-10 17:18:47 -03:00
|
|
|
ARG SKIP_AP_EXT_ENV=0
|
2023-08-13 15:14:54 -03:00
|
|
|
ARG SKIP_AP_GRAPHIC_ENV=1
|
|
|
|
ARG SKIP_AP_COV_ENV=1
|
|
|
|
ARG SKIP_AP_GIT_CHECK=1
|
|
|
|
|
2022-07-11 17:46:39 -03:00
|
|
|
RUN groupadd ${USER_NAME} --gid ${USER_GID}\
|
|
|
|
&& useradd -l -m ${USER_NAME} -u ${USER_UID} -g ${USER_GID} -s /bin/bash
|
2017-11-17 14:29:47 -04:00
|
|
|
|
2020-09-02 18:06:44 -03:00
|
|
|
RUN apt-get update && apt-get install --no-install-recommends -y \
|
2017-11-17 14:29:47 -04:00
|
|
|
lsb-release \
|
|
|
|
sudo \
|
2022-07-11 17:46:39 -03:00
|
|
|
tzdata \
|
|
|
|
bash-completion
|
2017-11-17 14:29:47 -04:00
|
|
|
|
2020-03-29 11:59:18 -03:00
|
|
|
COPY Tools/environment_install/install-prereqs-ubuntu.sh /ardupilot/Tools/environment_install/
|
|
|
|
COPY Tools/completion /ardupilot/Tools/completion/
|
|
|
|
|
|
|
|
# Create non root user for pip
|
2022-07-11 17:46:39 -03:00
|
|
|
RUN echo "ardupilot ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/${USER_NAME}
|
|
|
|
RUN chmod 0440 /etc/sudoers.d/${USER_NAME}
|
2019-11-23 22:30:34 -04:00
|
|
|
|
2022-07-11 17:46:39 -03:00
|
|
|
RUN chown -R ${USER_NAME}:${USER_NAME} /${USER_NAME}
|
2017-11-17 14:29:47 -04:00
|
|
|
|
2022-07-11 17:46:39 -03:00
|
|
|
USER ${USER_NAME}
|
2020-03-29 11:59:18 -03:00
|
|
|
|
2024-04-11 16:23:29 -03:00
|
|
|
RUN 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 \
|
|
|
|
USER=${USER_NAME} \
|
|
|
|
Tools/environment_install/install-prereqs-ubuntu.sh -y
|
2020-03-29 11:59:18 -03:00
|
|
|
|
|
|
|
# Check that local/bin are in PATH for pip --user installed package
|
2022-12-17 09:34:26 -04:00
|
|
|
RUN echo "if [ -d \"\$HOME/.local/bin\" ] ; then\nPATH=\"\$HOME/.local/bin:\$PATH\"\nfi" >> ~/.ardupilot_env
|
2022-07-11 17:46:39 -03:00
|
|
|
|
|
|
|
# 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
|
2020-03-29 11:59:18 -03:00
|
|
|
|
2020-08-17 09:37:32 -03:00
|
|
|
# Set the buildlogs directory into /tmp as other directory aren't accessible
|
|
|
|
ENV BUILDLOGS=/tmp/buildlogs
|
|
|
|
|
2020-03-29 11:59:18 -03:00
|
|
|
# Cleanup
|
2020-09-02 18:06:44 -03:00
|
|
|
RUN sudo apt-get clean \
|
2019-11-23 22:30:34 -04:00
|
|
|
&& sudo rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
|
|
|
|
2017-11-17 14:29:47 -04:00
|
|
|
ENV CCACHE_MAXSIZE=1G
|
2022-07-11 17:46:39 -03:00
|
|
|
ENTRYPOINT ["/ardupilot_entrypoint.sh"]
|
|
|
|
CMD ["bash"]
|