Skip to content

Commit

Permalink
Adapt to use the registry base image
Browse files Browse the repository at this point in the history
- shorter build but depends on registry
  • Loading branch information
nkssanjeevkuma committed Feb 20, 2025
1 parent cead1f5 commit 0e12335
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 32 deletions.
26 changes: 5 additions & 21 deletions .docker/build.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,21 @@
FROM scancontrol:base AS dev
FROM registry.tudelft.nl/samxl/scancontrol:humble-base AS dev
ARG TARGET_WS

SHELL ["/bin/bash", "-c"]

ENV DEBIAN_FRONTEND=noninteractive

# Create a non-root user
ENV ROS_USER=ros
ARG ROS_USER_UID=1000
ARG ROS_USER_GID=$ROS_USER_UID

RUN groupadd --gid $ROS_USER_GID $ROS_USER \
&& useradd -s /bin/bash --uid $ROS_USER_UID --gid $ROS_USER_GID -m $ROS_USER \
# [Optional] Add sudo support for the non-root user
&& apt-get update \
&& apt-get install -y sudo \
&& echo $ROS_USER ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/$ROS_USER\
&& chmod 0440 /etc/sudoers.d/$ROS_USER \
# Cleanup
&& rm -rf /var/lib/apt/lists/*

# Get build dependencies
RUN apt-get update \
&& apt-get install --no-install-recommends -y build-essential git python3-colcon-common-extensions python3-colcon-mixin python3-rosdep python3-vcstool \
&& rm -rf /var/lib/apt/lists/*
RUN sudo apt-get update \
&& sudo apt-get install --no-install-recommends -y build-essential git python3-colcon-common-extensions python3-colcon-mixin python3-rosdep python3-vcstool \
&& sudo rm -rf /var/lib/apt/lists/*

WORKDIR $TARGET_WS

# perform a copy here so previous layers still remain in cache
COPY . $TARGET_WS/src/scancontrol

RUN chown -R ${ROS_USER}:${ROS_USER} /workspaces
USER ${ROS_USER}
RUN sudo chown -R ${USERNAME}:${USERNAME} $TARGET_WS

# install rosdeps
RUN sudo -E rosdep init \
Expand Down
13 changes: 2 additions & 11 deletions .docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
name: scancontrol

services:
# Root dependencies needed to build ros packages
scancontrol-base:
build:
context: ${SCANCONTROL_SRC_DIR}
dockerfile: .docker/Dockerfile
image: "scancontrol:base"

# Builds the ROS package
scancontrol-build:
depends_on:
scancontrol-base:
condition: service_completed_successfully # start the ROS build only when base is done
container_name: scancontrol-build
build:
context: ${SCANCONTROL_SRC_DIR}
dockerfile: .docker/build.Dockerfile
Expand All @@ -21,7 +12,7 @@ services:
image: "scancontrol:build"
working_dir: ${SCANCONTROL_TARGET_WS}
user: ${PUID}:${PGID}
# command: tail -f /dev/null
command: tail -f /dev/null

# Runs the Scancontrol driver node as continuous service
scancontrol-service:
Expand Down

0 comments on commit 0e12335

Please sign in to comment.