Skip to content

Commit

Permalink
Resolve hadolint warns
Browse files Browse the repository at this point in the history
Signed-off-by: Oguz Ozturk <[email protected]>
  • Loading branch information
oguzkaganozt committed Feb 19, 2024
1 parent 1c6637e commit 0e5f9a3
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docker/autoware-openadk/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# hadolint global ignore=DL3006,DL3008,DL3009,DL3015,DL3013,DL3027,DL3042
ARG BASE_IMAGE

FROM $BASE_IMAGE as base
Expand Down Expand Up @@ -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
Expand Down
7 changes: 4 additions & 3 deletions docker/autoware-openadk/etc/dev_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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
Expand All @@ -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
1 change: 1 addition & 0 deletions docker/autoware-openadk/etc/ros_entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# hadolint global ignore=SC1090,SC1091
set -e

# hadolint ignore=SC1090
Expand Down
6 changes: 3 additions & 3 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0e5f9a3

Please sign in to comment.