mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-09 03:51:35 +08:00
docker: single tag to rule them all
the new docker images are defaulting to a hardcoded tag that can be traced back to source code which is why we are adding the string to the build and run scripts
This commit is contained in:
@@ -1,20 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z "${DOCKER_TAG}" ]]; then
|
||||
TAG_NAME="latest"
|
||||
# the default tag for docker images
|
||||
# follows the pattern below, and we recommend
|
||||
# that any images pushed to the registry continue
|
||||
# to use the pattern for consistency
|
||||
TAG_NAME="`date +"%Y-%m-%d"`"
|
||||
else
|
||||
TAG_NAME="${DOCKER_TAG}"
|
||||
fi
|
||||
|
||||
PX4_DOCKER_REPO="px4io/px4-dev:$TAG_NAME"
|
||||
BUILD_ARGS="${@}"
|
||||
PX4_DOCKER_REPO="ghcr.io/px4/px4-dev:$TAG_NAME"
|
||||
PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
SRC_DIR=$PWD/../
|
||||
|
||||
echo "[docker_build.sh]: Building [$PX4_DOCKER_REPO]"
|
||||
echo "[docker_build.sh]: - with args: [$BUILD_ARGS]"
|
||||
|
||||
docker build \
|
||||
-t ${PX4_DOCKER_REPO} \
|
||||
-f Tools/setup/Dockerfile "${SRC_DIR}" \
|
||||
--build-arg INSTALL_ARGS="${BUILD_ARGS}"
|
||||
-f Tools/setup/Dockerfile "${SRC_DIR}"
|
||||
|
||||
+4
-2
@@ -1,12 +1,14 @@
|
||||
#!/bin/bash
|
||||
|
||||
if [[ -z "${DOCKER_TAG}" ]]; then
|
||||
TAG_NAME="latest"
|
||||
# The default tag name should be hardcoded
|
||||
# to whatever we are currently using in CI on this branch
|
||||
TAG_NAME="2022-08-16"
|
||||
else
|
||||
TAG_NAME="${DOCKER_TAG}"
|
||||
fi
|
||||
|
||||
PX4_DOCKER_REPO="px4io/px4-dev:$TAG_NAME"
|
||||
PX4_DOCKER_REPO="ghcr.io/px4/px4-dev:$TAG_NAME"
|
||||
|
||||
echo "[docker_run.sh]: Running '$PX4_DOCKER_REPO'"
|
||||
|
||||
|
||||
+1
-10
@@ -24,21 +24,12 @@ RUN apt-get update && apt-get -y --quiet --no-install-recommends install \
|
||||
# Install PX4 Requirements
|
||||
COPY Tools/setup/requirements.txt /tmp/requirements.txt
|
||||
COPY Tools/setup/ubuntu.sh /tmp/ubuntu.sh
|
||||
# We support pre-downloading the gcc arm none eabi compiler
|
||||
# to speed up build times, if the file is not present when
|
||||
# building, the ubuntu.sh script will download it from source
|
||||
# To make this conditional, copy an extra 'dummy' file as well
|
||||
COPY Tools/setup/dummy.file gcc-arm-none-eabi-9-2020-q2-update-linux.tar.* /tmp/
|
||||
# The PATH env is set within ubuntu.sh, but given how we
|
||||
# are running the image using `gosu` to avoid read-only problems
|
||||
# with the filesystem the env variable does not persist
|
||||
ENV PATH="/opt/gcc-arm-none-eabi-9-2020-q2-update/bin:$PATH"
|
||||
ENV PATH="/opt/jdk-14.0.2+12/bin:$PATH"
|
||||
|
||||
# For a complete list of INSTALL_ARGS options run:
|
||||
# ./Tools/setup/ubuntu.sh --help
|
||||
ARG INSTALL_ARGS
|
||||
RUN bash /tmp/ubuntu.sh --from-docker $INSTALL_ARGS
|
||||
RUN bash /tmp/ubuntu.sh --from-docker
|
||||
|
||||
ENV DISPLAY :99
|
||||
|
||||
|
||||
@@ -209,16 +209,9 @@ if [[ $INSTALL_NUTTX == "true" ]]; then
|
||||
else
|
||||
echo "📌 The arm cross compiler was not found";
|
||||
echo " * Installing arm-none-eabi-gcc-${NUTTX_GCC_VERSION}";
|
||||
# The arm cross compiler hosting provider is known to throttle download speeds
|
||||
# for users who reach a certain limit of downloads in a given time frame
|
||||
# for this reason we allow for using a previously downloaded file
|
||||
# this is specially helpful when debugging this installer script
|
||||
# from within a container COMPILER_PATH="/tmp/gcc-arm-none-eabi-${NUTTX_GCC_VERSION}-linux.tar.bz2"
|
||||
COMPILER_NAME="gcc-arm-none-eabi-${NUTTX_GCC_VERSION}"
|
||||
COMPILER_PATH="/tmp/$COMPILER_NAME-linux.tar.bz2"
|
||||
if [ ! -f "$COMPILER_PATH" ]; then
|
||||
wget -O $COMPILER_PATH https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/${NUTTX_GCC_VERSION_SHORT}/${COMPILER_NAME}-${INSTALL_ARCH}-linux.tar.bz2
|
||||
fi
|
||||
wget -O $COMPILER_PATH https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/${NUTTX_GCC_VERSION_SHORT}/${COMPILER_NAME}-${INSTALL_ARCH}-linux.tar.bz2
|
||||
sudo tar -jxf $COMPILER_PATH -C /opt/;
|
||||
|
||||
# add arm-none-eabi-gcc to user's PATH
|
||||
|
||||
Reference in New Issue
Block a user