Skip to content

Commit

Permalink
Fix build dev image wokflow (#77)
Browse files Browse the repository at this point in the history
* Comment out build-dev.sh contents

* Update dev dockerfile filename

* Update dev image tag

* Clean up dockerfiles

* Remove libspot and update to latest ompl commit

* Rename ros images

* Update dev image tag

* Remove build-dev.sh, as dev image is built by ci

* Remove ament_pep257
  • Loading branch information
patrick-5546 authored Jan 19, 2023
1 parent be91c4f commit 1e20422
Show file tree
Hide file tree
Showing 7 changed files with 68 additions and 80 deletions.
22 changes: 11 additions & 11 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,26 +1,26 @@
FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:ros_humble-ompl_d8375d8-amd64
FROM ghcr.io/ubcsailbot/sailbot_workspace/dev:fix-build-dev-image-ci

# # Uncomment this section to install the apt packages used in the ROS 2 tutorials
# ENV DEBIAN_FRONTEND=noninteractive
# RUN apt-get update && \
# apt-get install -y \
# RUN apt-get update \
# && apt-get install -y \
# # Your package list here
# ros-humble-turtlesim \
# # Clean up
# && apt-get autoremove -y && \
# apt-get clean -y && \
# rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# && apt-get autoremove -y \
# && apt-get clean -y \
# && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# ENV DEBIAN_FRONTEND=

# # Uncomment this section to install additional apt packages
# ENV DEBIAN_FRONTEND=noninteractive
# RUN apt-get update && \
# apt-get install -y \
# RUN apt-get update \
# && apt-get install -y \
# # Your package list here
# # Clean up
# && apt-get autoremove -y && \
# apt-get clean -y && \
# rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# && apt-get autoremove -y \
# && apt-get clean -y \
# && rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
# ENV DEBIAN_FRONTEND=

# Copy configuration files (e.g., .vimrc) from config/ to the container's home directory
Expand Down
71 changes: 32 additions & 39 deletions .devcontainer/base/base.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
FROM ubuntu:22.04 AS ompl
FROM ubuntu:22.04 AS ompl-source

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y git && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN apt-get update \
&& apt-get install -y git \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN git clone https://github.com/ompl/ompl.git
WORKDIR /ompl
RUN git reset --hard d8375d8
RUN git reset --hard 1bb0aa2

# From https://github.com/athackst/dockerfiles/blob/32a872348af0ad25ec4a6e6184cb803357acb6ab/ros2/humble.Dockerfile
FROM ubuntu:22.04 AS base
FROM ubuntu:22.04 AS ros-base

ENV DEBIAN_FRONTEND=noninteractive

Expand Down Expand Up @@ -54,16 +54,13 @@ ENV ROS_PYTHON_VERSION=3
ENV ROS_VERSION=2
ENV DEBIAN_FRONTEND=

# Based on https://github.com/ompl/ompl/blob/d8375d842a7f016d64f27a81d6f95eaa83fbe595/scripts/docker/ompl.Dockerfile
FROM base AS builder
# Based on https://github.com/ompl/ompl/blob/1bb0aa2cae0d5e30eee6efca4a9d10a2da1971dc/scripts/docker/ompl.Dockerfile
FROM ros-base AS ompl-builder
# avoid interactive configuration dialog from tzdata, which gets pulled in
# as a dependency
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:asiffer/libspot && \
apt-get update && \
apt-get install -y \
RUN apt-get update \
&& apt-get install -y \
build-essential \
castxml \
cmake \
Expand All @@ -78,38 +75,36 @@ RUN apt-get update && \
libexpat1 \
libflann-dev \
libode-dev \
libspot-dev \
libtriangle-dev \
ninja-build \
pkg-config \
python3-dev \
python3-numpy \
python3-pip \
pypy3 \
wget && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
wget \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
RUN pip3 install pygccxml pyplusplus
COPY --from=ompl /ompl /ompl
COPY --from=ompl-source /ompl /ompl
WORKDIR /build
RUN cmake \
-DPYTHON_EXEC=/usr/bin/python3 \
-DOMPL_REGISTRATION=OFF \
-DCMAKE_INSTALL_PREFIX=/usr \
-G Ninja \
/ompl && \
ninja update_bindings -j `nproc` && \
ninja -j `nproc` && \
ninja install
/ompl \
&& ninja update_bindings -j `nproc` \
&& ninja -j `nproc` \
&& ninja install

FROM ros-base as base
LABEL org.opencontainers.image.source https://github.com/UBCSailbot/sailbot_workspace

FROM base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y software-properties-common && \
add-apt-repository ppa:asiffer/libspot && \
apt-get update && \
apt-get install -y \
RUN apt-get update \
&& apt-get install -y \
build-essential \
cmake \
libboost-filesystem-dev \
Expand All @@ -121,18 +116,16 @@ RUN apt-get update && \
libeigen3-dev \
libflann-dev \
libode-dev \
libspot-dev \
libtriangle-dev \
ninja-build \
pkg-config \
python3-dev \
python3-numpy \
python3-pip \
wget && \
apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*

COPY --from=builder /usr /usr
wget \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
ENV DEBIAN_FRONTEND=

LABEL org.opencontainers.image.source https://github.com/UBCSailbot/sailbot_workspace
COPY --from=ompl-builder /usr /usr
12 changes: 6 additions & 6 deletions .devcontainer/base/build-base.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

docker build . \
--file base.Dockerfile \
--tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-amd64 \
--tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2-amd64 \
--build-arg ARCH=amd64/

# docker build . \
# --file base.Dockerfile \
# --tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-arm64v8 \
# --tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2-arm64v8 \
# --build-arg ARCH=arm64v8/

# docker buildx build . \
# --file base.Dockerfile
# --tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8 \
# --tag ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2 \
# --platform linux/arm64/v8,linux/amd64 \
# # --push

# docker manifest create ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-latest \
# --amend ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-amd64 \
# --amend ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-arm64v8
# docker manifest create ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2-latest \
# --amend ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2-amd64 \
# --amend ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2-arm64v8
6 changes: 0 additions & 6 deletions .devcontainer/dev/build-dev.sh

This file was deleted.

34 changes: 17 additions & 17 deletions .devcontainer/dev/dev.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_d8375d8-amd64 as dev
FROM ghcr.io/ubcsailbot/sailbot_workspace/base:ros_humble-ompl_1bb0aa2-amd64 as ros-dev

# From https://github.com/athackst/dockerfiles/blob/32a872348af0ad25ec4a6e6184cb803357acb6ab/ros2/humble.Dockerfile
ENV DEBIAN_FRONTEND=noninteractive
Expand Down Expand Up @@ -47,7 +47,7 @@ RUN groupadd --gid $USER_GID $USERNAME \
ENV DEBIAN_FRONTEND=
ENV AMENT_CPPCHECK_ALLOW_SLOW_VERSIONS=1

FROM dev
FROM ros-dev as dev

ARG USERNAME=ros
ARG HOME=/home/$USERNAME
Expand All @@ -57,11 +57,11 @@ RUN mkdir -p ${HOME}/.ros/log \
&& chown -R ${USERNAME} ${HOME}/.ros

# persist bash history
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=${HOME}/commandhistory/.bash_history" && \
mkdir ${HOME}/commandhistory && \
touch ${HOME}/commandhistory/.bash_history && \
chown ${USERNAME} ${HOME}/commandhistory/.bash_history && \
echo $SNIPPET >> "${HOME}/.bashrc"
RUN SNIPPET="export PROMPT_COMMAND='history -a' && export HISTFILE=${HOME}/commandhistory/.bash_history" \
&& mkdir ${HOME}/commandhistory \
&& touch ${HOME}/commandhistory/.bash_history \
&& chown ${USERNAME} ${HOME}/commandhistory/.bash_history \
&& echo $SNIPPET >> "${HOME}/.bashrc"

ARG ROS_WORKSPACE=/workspaces/sailbot_workspace

Expand All @@ -72,8 +72,8 @@ RUN chmod +x /sbin/update-bashrc ; chown ros /sbin/update-bashrc ; sync ; /bin/b
# install clang, some clang tools, and protobuf for network systems
# TODO: move required apt packages to base image
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
RUN apt-get update \
&& apt-get install -y \
clang \
clang-tidy \
clangd \
Expand All @@ -82,9 +82,9 @@ RUN apt-get update && \
libprotobuf-dev \
llvm \
protobuf-compiler \
&& apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
ENV DEBIAN_FRONTEND=

# install git-delta
Expand All @@ -94,12 +94,12 @@ RUN rm git-delta-musl_0.14.0_amd64.deb

# install other helpful apt packages
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get install -y \
RUN apt-get update \
&& apt-get install -y \
less \
openssh-client \
tmux \
&& apt-get autoremove -y && \
apt-get clean -y && \
rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/{apt,dpkg,cache,log} /tmp/* /var/tmp/*
ENV DEBIAN_FRONTEND=
1 change: 1 addition & 0 deletions .github/workflows/build-dev-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:
uses: docker/build-push-action@v3
with:
context: "{{defaultContext}}:.devcontainer/dev"
file: dev.Dockerfile
push: true
tags: ghcr.io/ubcsailbot/sailbot_workspace/dev:${{ inputs.tag }}
cache-from: type=gha
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
linter: [lint_cmake, xmllint, flake8, pep257]
linter: [lint_cmake, xmllint, flake8]
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand Down

0 comments on commit 1e20422

Please sign in to comment.