Skip to content

Commit

Permalink
Merge dockerfiles
Browse files Browse the repository at this point in the history
  • Loading branch information
dave992 committed Nov 21, 2024
1 parent f9801c0 commit 131886e
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 170 deletions.
56 changes: 53 additions & 3 deletions .docker/Dockerfile.CI → .docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
ARG SCANCONTROL_SDK_VERSION=1.0.0

################################################################################
# Build .deb packages for Aravis and scanCONTROL SDK
################################################################################
FROM ubuntu:22.04 AS build

ARG SCANCONTROL_SDK_VERSION
Expand Down Expand Up @@ -67,12 +70,16 @@ RUN mkdir /library_pkgs && \
mv "/scanCONTROL-Linux-SDK/libmescan/builddir/mescan_${SCANCONTROL_SDK_VERSION}-1_amd64.deb" /library_pkgs && \
mv "/scanCONTROL-Linux-SDK/libllt/builddir/llt_${SCANCONTROL_SDK_VERSION}-1_amd64.deb" /library_pkgs

FROM ros:humble-ros-core
################################################################################
# ros-core and Aravis + scanCONTROL SDK
# for use with CI
################################################################################
FROM ros:humble-ros-core AS scancontrol-core
ARG SCANCONTROL_SDK_VERSION

RUN apt-get update && apt-get install -y --no-install-recommends\
build-essential \
pkg-config \
build-essential \
pkg-config \
&& rm -rf /var/lib/apt/lists/*

COPY --from=build ["/library_pkgs", "/library_pkgs"]
Expand All @@ -83,3 +90,46 @@ RUN apt-get update && \
apt install /library_pkgs/llt_${SCANCONTROL_SDK_VERSION}-1_amd64.deb \
&& rm -rf /var/lib/apt/lists/*

################################################################################
# ros-core and Aravis + scanCONTROL SDK + non-root user
# for use as a base image in development or deployment
################################################################################
FROM scancontrol-core AS scancontrol-base

# Create a non-root user
ARG USERNAME=ros
ARG USER_UID=1000
ARG USER_GID=$USER_UID

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

# Set up autocompletion for user
RUN apt-get update && apt-get install -y git-core bash-completion \
&& echo "if [ -f /opt/ros/${ROS_DISTRO}/setup.bash ]; then source /opt/ros/${ROS_DISTRO}/setup.bash; fi" >> /home/${USERNAME}/.bashrc \
&& echo "if [ -f /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash ]; then source /usr/share/colcon_argcomplete/hook/colcon-argcomplete.bash; fi" >> /home/$USERNAME/.bashrc \
&& rm -rf /var/lib/apt/lists/*

# Switch to the ROS_USER for the remaining instructions
USER $USERNAME

################################################################################
# ros-desktop and Aravis + scanCONTROL SDK + non-root user
# for use as a base image in development
################################################################################
FROM scancontrol-base AS scancontrol-dev

ENV DEBIAN_FRONTEND=noninteractive

# Install the full release
RUN sudo apt-get update && sudo apt-get install -y --no-install-recommends \
ros-humble-desktop \
&& sudo rm -rf /var/lib/apt/lists/*

ENV DEBIAN_FRONTEND=
166 changes: 0 additions & 166 deletions .docker/Dockerfile.dev

This file was deleted.

2 changes: 1 addition & 1 deletion .docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ services:
container_name: scancontrol-container
build:
context: .
dockerfile: Dockerfile.dev
dockerfile: Dockerfile
user: ros
working_dir: /home/ros/workspace
# command: >
Expand Down

0 comments on commit 131886e

Please sign in to comment.