From 0e5f9a3fbe2c9c9151d4e4eb1d55e651c706087a Mon Sep 17 00:00:00 2001 From: Oguz Ozturk Date: Mon, 19 Feb 2024 16:41:44 +0300 Subject: [PATCH] Resolve hadolint warns Signed-off-by: Oguz Ozturk --- docker/autoware-openadk/Dockerfile | 3 ++- docker/autoware-openadk/etc/dev_entrypoint.sh | 7 ++++--- docker/autoware-openadk/etc/ros_entrypoint.sh | 1 + docker/run.sh | 6 +++--- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docker/autoware-openadk/Dockerfile b/docker/autoware-openadk/Dockerfile index ac1cb2c6eb2..5790c7eb2ac 100644 --- a/docker/autoware-openadk/Dockerfile +++ b/docker/autoware-openadk/Dockerfile @@ -1,3 +1,4 @@ +# hadolint global ignore=DL3006,DL3008,DL3009,DL3015,DL3013,DL3027,DL3042 ARG BASE_IMAGE FROM $BASE_IMAGE as base @@ -90,7 +91,7 @@ RUN --mount=type=ssh \ # Instal gosu for switching to local user in entrypoint RUN --mount=type=ssh \ - apt-get update && apt-get install -y gosu \ + apt-get update && apt-get install --no-install-recommends -y gosu \ && apt-get autoremove -y && apt-get clean -y && rm -rf /var/lib/apt/lists/* "$HOME"/.cache # Change working directory to workspace diff --git a/docker/autoware-openadk/etc/dev_entrypoint.sh b/docker/autoware-openadk/etc/dev_entrypoint.sh index 9fd66da7efa..e421b2dad0d 100644 --- a/docker/autoware-openadk/etc/dev_entrypoint.sh +++ b/docker/autoware-openadk/etc/dev_entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash +# hadolint global ignore=SC1090,SC1091 # Get the user ID and group ID of the local user USER_ID=${LOCAL_UID} @@ -13,8 +14,8 @@ else echo "Starting with user: $USER_NAME >> UID $USER_ID, GID: $GROUP_ID" # Create group and user with GID/UID - groupadd -g $GROUP_ID $GROUP_NAME - useradd -u $USER_ID -g $GROUP_ID -s /bin/bash -m -d /home/$USER_NAME $USER_NAME + groupadd -g "$GROUP_ID" "$GROUP_NAME" + useradd -u "$USER_ID" -g "$GROUP_ID" -s /bin/bash -m -d /home/"$USER_NAME" "$USER_NAME" # Add sudo privileges to the user echo "$USER_NAME ALL=(ALL) NOPASSWD:ALL" >>/etc/sudoers @@ -24,5 +25,5 @@ else source "/opt/ros/$ROS_DISTRO/setup.bash" # Execute the command as the user - exec /usr/sbin/gosu $USER_NAME "$@" + exec /usr/sbin/gosu "$USER_NAME" "$@" fi diff --git a/docker/autoware-openadk/etc/ros_entrypoint.sh b/docker/autoware-openadk/etc/ros_entrypoint.sh index efeffbf7d55..83a63f8e70b 100644 --- a/docker/autoware-openadk/etc/ros_entrypoint.sh +++ b/docker/autoware-openadk/etc/ros_entrypoint.sh @@ -1,4 +1,5 @@ #!/bin/bash +# hadolint global ignore=SC1090,SC1091 set -e # hadolint ignore=SC1090 diff --git a/docker/run.sh b/docker/run.sh index 856be9b1d17..eba8f6ca627 100755 --- a/docker/run.sh +++ b/docker/run.sh @@ -137,9 +137,9 @@ main() { echo "docker run -it --rm --net=host ${GPU_FLAG} ${USER_ID} ${MOUNT_X} ${WORKSPACE} ${MAP} ${IMAGE} ${LAUNCH_CMD}" echo "------------------------------------" sleep 2 - docker run -it --rm --net=host ${GPU_FLAG} ${USER_ID} ${MOUNT_X} \ - ${WORKSPACE} ${MAP} ${IMAGE} \ - ${LAUNCH_CMD} + docker run -it --rm --net=host "${GPU_FLAG}" "${USER_ID}" "${MOUNT_X}" \ + "${WORKSPACE}" "${MAP}" "${IMAGE}" \ + "${LAUNCH_CMD}" } # Execute the main script