cps_loki/docker/Dockerfile

142 lines
4.4 KiB
Docker
Raw Permalink Normal View History

2023-08-02 14:18:54 +00:00
ARG ROS_DISTRO=humble
2023-08-02 17:12:24 +00:00
ARG UNDERLAY_WS=bot_mini_ws
ARG OVERLAY_WS=overlay_ws
2023-08-02 14:18:54 +00:00
# This file should work for both amd64 and arm64 builds.
2023-08-02 17:12:24 +00:00
## Problem! some variables not working currently. Need to find out why.
# For now, the variables are replaced with fixed values.
2023-08-02 14:18:54 +00:00
########################################
# Base Image for Bot Mini Control #
########################################
FROM ros:${ROS_DISTRO} as base
SHELL ["/bin/bash", "-c"]
2023-08-02 16:38:36 +00:00
ENV ROS_DISTRO=${ROS_DISTRO}
ENV UNDERLAY_WS=${UNDERLAY_WS}
ENV OVERLAY_WS=${OVERLAY_WS}
2023-08-02 17:12:24 +00:00
RUN echo "successfully sourced ENV variables: ROS_DISTRO=${ROS_DISTRO}, UNDERLAY_WS=${UNDERLAY_WS}, OVERLAY_WS=${OVERLAY_WS}"
2023-08-02 14:18:54 +00:00
# Create Colcon workspace with external dependencies
2023-08-02 17:12:24 +00:00
RUN mkdir -p /bot_mini_ws/src
WORKDIR /bot_mini_ws/src
2023-08-02 14:18:54 +00:00
COPY dependencies.repos .
#RUN vcs import < dependencies.repos
RUN vcs import < dependencies.repos;
# Build the base Colcon workspace, installing dependencies first.
2023-08-02 17:12:24 +00:00
WORKDIR /bot_mini_ws
2023-08-02 14:18:54 +00:00
RUN source /opt/ros/${ROS_DISTRO}/setup.bash \
&& apt-get update -y \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \
&& colcon build --symlink-install \
&& rm -rf /var/lib/apt/lists/*
# Use Cyclone DDS as middleware
RUN apt-get update && apt-get install -y --no-install-recommends \
2023-11-30 11:05:38 +00:00
nano \
2023-08-02 14:18:54 +00:00
ros-${ROS_DISTRO}-rmw-cyclonedds-cpp \
ros-${ROS_DISTRO}-xacro \
&& rm -rf /var/lib/apt/lists/*
2024-02-08 10:48:19 +00:00
# Install Foxglove Bridge
RUN apt-get update && apt-get install -y --no-install-recommends \
ros-${ROS_DISTRO}-foxglove-bridge \
&& rm -rf /var/lib/apt/lists/*
2023-08-02 14:18:54 +00:00
ENV RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
###########################################
# Overlay Image for Bot Mini Control #
###########################################
FROM base AS overlay
# Create an overlay Colcon workspace
2023-08-02 17:12:24 +00:00
RUN mkdir -p /overlay_ws/src
WORKDIR /overlay_ws/src
2023-08-02 14:18:54 +00:00
COPY overlay.repos .
RUN vcs import < overlay.repos
2023-11-30 11:08:02 +00:00
RUN vcs import < cam_ffmpeg/ffmpeg_image_transport.repos
2023-08-02 14:18:54 +00:00
2023-08-02 17:12:24 +00:00
WORKDIR /overlay_ws
2023-08-02 14:18:54 +00:00
2023-08-02 17:12:24 +00:00
RUN source /bot_mini_ws/install/setup.bash \
2023-08-02 14:18:54 +00:00
&& apt-get update \
2023-11-30 10:50:57 +00:00
&& apt-get install -y ros-${ROS_DISTRO}-image-transport ros-${ROS_DISTRO}-cv-bridge \
2023-08-02 14:18:54 +00:00
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \
2023-11-30 11:35:32 +00:00
&& colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo\
2023-08-02 14:18:54 +00:00
&& rm -rf /var/lib/apt/lists/*
# Set up the entrypoint
COPY ./docker/entrypoint.sh /
RUN chmod +x /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]
###########################################
# GUI Additions for Ros2 #
###########################################
FROM overlay AS guis
# Install additional GUI tools
2023-08-02 17:12:24 +00:00
RUN source /bot_mini_ws/install/setup.bash \
2023-08-02 14:18:54 +00:00
&& colcon build --symlink-install \
&& apt-get update \
&& apt-get install -y --no-install-recommends ros-${ROS_DISTRO}-rviz2 \
&& rosdep install --from-paths src --ignore-src --rosdistro ${ROS_DISTRO} -y \
&& rm -rf /var/lib/apt/lists/*
# Set up the entrypoint
ENTRYPOINT [ "/entrypoint.sh" ]
2023-11-30 08:47:57 +00:00
LABEL org.opencontainers.image.source=https://github.com/bjoernellens1/cps_loki
#############################################
# OliveTin Build #
#############################################
2024-01-11 15:07:52 +00:00
FROM registry.fedoraproject.org/fedora:39 AS olivetin
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
LABEL org.opencontainers.image.source https://ghcr.io/bjoernellens1/cps_bot_mini_ws/olivetin
LABEL org.opencontainers.image.title=OliveTin
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
# Making sure there is newest docker version installed
RUN dnf -y install dnf-plugins-core \
&& dnf -y install 'dnf-command(config-manager)' \
&& dnf config-manager --add-repo https://download.docker.com/linux/fedora/docker-ce.repo \
&& dnf -y install docker-ce-cli docker-compose-plugin --setopt=install_weak_deps=False
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
# Install OliveTin and dependencies
RUN mkdir -p /config /var/www/olivetin \
&& dnf install -y --nodocs --noplugins --setopt=keepcache=0 --setopt=install_weak_deps=0 \
iputils \
openssh-clients \
shadow-utils \
OliveTin \
&& dnf clean all
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
RUN useradd --system --create-home olivetin -u 1000
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
EXPOSE 1337/tcp
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
VOLUME /config
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
USER olivetin
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
ENTRYPOINT [ "/usr/bin/OliveTin" ]
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
FROM docker AS olivetin
2023-11-30 08:47:57 +00:00
2024-01-11 15:07:52 +00:00
RUN wget https://github.com/OliveTin/OliveTin/releases/latest/download/OliveTin_linux_amd64.apk
RUN apk add --allow-untrusted OliveTin_linux_amd64.apk
# RUN wget https://github.com/OliveTin/OliveTin/releases/download/2023.12.21/OliveTin_linux_amd64.deb
# RUN apt install ./OliveTin_linux_amd64.deb
2023-11-30 09:58:02 +00:00
2024-01-11 15:07:52 +00:00
# Expose the default OliveTin port
EXPOSE 1337
2023-11-30 10:00:55 +00:00
2024-01-11 15:07:52 +00:00
# Set the default command to run OliveTin
CMD ["OliveTin"]