Merge pull request #5 from RonaldsonBellande/noetic

docker
This commit is contained in:
Ronaldson Bellande 2022-08-02 23:33:12 -04:00 committed by GitHub
commit 3e2d23244e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 286 additions and 93 deletions

View File

@ -1,93 +0,0 @@
name: Docker
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
on:
schedule:
- cron: '28 19 * * *'
push:
branches: [ noetic ]
# Publish semver tags as releases.
tags: [ 'v*.*.*' ]
pull_request:
branches: [ noetic ]
env:
# Use docker.io for Docker Hub if empty
REGISTRY: ghcr.io
# github.repository as <account>/<repo>
IMAGE_NAME: ${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
# This is used to complete the identity challenge
# with sigstore/fulcio when running outside of PRs.
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
# Install the cosign tool except on PR
# https://github.com/sigstore/cosign-installer
- name: Install cosign
if: github.event_name != 'pull_request'
uses: sigstore/cosign-installer@d6a3abf1bdea83574e28d40543793018b6035605
with:
cosign-release: 'v1.7.1'
# Workaround: https://github.com/docker/build-push-action/issues/461
- name: Setup Docker buildx
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
# Login against a Docker registry except on PR
# https://github.com/docker/login-action
- name: Log into registry ${{ env.REGISTRY }}
if: github.event_name != 'pull_request'
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Extract metadata (tags, labels) for Docker
# https://github.com/docker/metadata-action
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
# Build and push Docker image with Buildx (don't push on PR)
# https://github.com/docker/build-push-action
- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# Sign the resulting Docker image digest except on PRs.
# This will only write to the public Rekor transparency log when the Docker
# repository is public to avoid leaking data. If you would like to publish
# transparency data even for private images, pass --force to cosign below.
# https://github.com/sigstore/cosign
- name: Sign the published Docker image
if: ${{ github.event_name != 'pull_request' }}
env:
COSIGN_EXPERIMENTAL: "true"
# This step uses the identity token to provision an ephemeral certificate
# against the sigstore community Fulcio instance.
run: cosign sign ${{ steps.meta.outputs.tags }}@${{ steps.build-and-push.outputs.digest }}

114
Dockerfile Normal file
View File

@ -0,0 +1,114 @@
FROM ubuntu:20.04 as base_build
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHON_VERSION="3.8"
ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r32.5.0
ARG ROS_ENVIROMENT_VERSION_GIT_BRANCH=master
ARG ROS_ENVIROMENT_VERSION_GIT_COMMIT=HEAD
LABEL maintainer=ronaldsonbellande@gmail.com
LABEL ros_enviroment_github_branchtag=${ROS_ENVIROMENT_VERSION_GIT_BRANCH}
LABEL ros_enviroment_github_commit=${ROS_ENVIROMENT_VERSION_GIT_COMMIT}
# Ubuntu setup
RUN apt-get update -y
RUN apt-get upgrade -y
# RUN workspace and sourcing
WORKDIR ./
COPY requirements.txt .
ARG ROS_PKG=ros_base
ENV ROS_DISTRO=noetic
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
ENV DEBIAN_FRONTEND=noninteractive
# add the ROS deb repo to the apt sources list
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
cmake \
build-essential \
curl \
wget \
gnupg2 \
lsb-release \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
# install bootstrap dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpython3-dev \
python3-rosdep \
python3-rosinstall-generator \
python3-vcstool \
build-essential && \
rosdep init && \
rosdep update && \
rm -rf /var/lib/apt/lists/*
# download/build the ROS source
RUN mkdir ros_catkin_ws && \
cd ros_catkin_ws && \
rosinstall_generator ${ROS_PKG} vision_msgs --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}-${ROS_PKG}.rosinstall && \
mkdir src && \
vcs import --input ${ROS_DISTRO}-${ROS_PKG}.rosinstall ./src && \
apt-get update && \
rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro ${ROS_DISTRO} --skip-keys python3-pykdl -y && \
python3 ./src/catkin/bin/catkin_make_isolated --install --install-space ${ROS_ROOT} -DCMAKE_BUILD_TYPE=Release && \
rm -rf /var/lib/apt/lists/*
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
automake \
build-essential \
ca-certificates \
curl \
git \
python3-pip \
libcurl3-dev \
libfreetype6-dev \
libpng-dev \
libtool \
libzmq3-dev \
mlocate \
openjdk-8-jdk\
openjdk-8-jre-headless \
pkg-config \
python-dev \
software-properties-common \
swig \
unzip \
wget \
zip \
zlib1g-dev \
python3-distutils \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install python 3.8 and make primary
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y \
python3.8 python3.8-dev python3-pip python3.8-venv && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
# pip install
RUN pip3 install --upgrade pip
RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py
# Install python libraries
RUN pip --no-cache-dir install -r requirements.txt

144
gpu.Dockerfile Normal file
View File

@ -0,0 +1,144 @@
FROM ubuntu:20.04 as base_build
ENV DEBIAN_FRONTEND noninteractive
ENV PYTHON_VERSION="3.8"
ARG BASE_IMAGE=nvcr.io/nvidia/l4t-base:r32.5.0
ARG ROS_ENVIROMENT_VERSION_GIT_BRANCH=master
ARG ROS_ENVIROMENT_VERSION_GIT_COMMIT=HEAD
LABEL maintainer=ronaldsonbellande@gmail.com
LABEL ros_enviroment_github_branchtag=${ROS_ENVIROMENT_VERSION_GIT_BRANCH}
LABEL ros_enviroment_github_commit=${ROS_ENVIROMENT_VERSION_GIT_COMMIT}
# Ubuntu setup
RUN apt-get update -y
RUN apt-get upgrade -y
# RUN workspace and sourcing
WORKDIR ./
COPY requirements.txt .
ARG ROS_PKG=ros_base
ENV ROS_DISTRO=noetic
ENV ROS_ROOT=/opt/ros/${ROS_DISTRO}
ENV DEBIAN_FRONTEND=noninteractive
# add the ROS deb repo to the apt sources list
RUN apt-get update && \
apt-get install -y --no-install-recommends \
git \
cmake \
build-essential \
curl \
wget \
gnupg2 \
lsb-release \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
RUN sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
RUN curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | apt-key add -
# install bootstrap dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
libpython3-dev \
python3-rosdep \
python3-rosinstall-generator \
python3-vcstool \
build-essential && \
rosdep init && \
rosdep update && \
rm -rf /var/lib/apt/lists/*
# download/build the ROS source
RUN mkdir ros_catkin_ws && \
cd ros_catkin_ws && \
rosinstall_generator ${ROS_PKG} vision_msgs --rosdistro ${ROS_DISTRO} --deps --tar > ${ROS_DISTRO}-${ROS_PKG}.rosinstall && \
mkdir src && \
vcs import --input ${ROS_DISTRO}-${ROS_PKG}.rosinstall ./src && \
apt-get update && \
rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro ${ROS_DISTRO} --skip-keys python3-pykdl -y && \
python3 ./src/catkin/bin/catkin_make_isolated --install --install-space ${ROS_ROOT} -DCMAKE_BUILD_TYPE=Release && \
rm -rf /var/lib/apt/lists/*
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
apt-utils \
automake \
build-essential \
ca-certificates \
curl \
git \
python3-pip \
libcurl3-dev \
libfreetype6-dev \
libpng-dev \
libtool \
libzmq3-dev \
mlocate \
openjdk-8-jdk\
openjdk-8-jre-headless \
pkg-config \
python-dev \
software-properties-common \
swig \
unzip \
wget \
zip \
zlib1g-dev \
python3-distutils \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
# Install python 3.8 and make primary
RUN add-apt-repository ppa:deadsnakes/ppa && \
apt-get update && apt-get install -y \
python3.8 python3.8-dev python3-pip python3.8-venv && \
update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1
# pip install
RUN pip3 install --upgrade pip
RUN curl -fSsL -O https://bootstrap.pypa.io/get-pip.py && \
python3 get-pip.py && \
rm get-pip.py
# Install python libraries
RUN pip --no-cache-dir install -r requirements.txt
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub && \
apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
cuda-command-line-tools-11-2 \
cuda-nvrtc-${CUDA/./-} \
libcublas-11-2 \
libcublas-dev-11-2 \
libcufft-11-2 \
libcurand-11-2 \
libcusolver-11-2 \
libcusparse-11-2 \
libcudnn8=${CUDNN_VERSION}-1+cuda${CUDA} \
libgomp1 \
build-essential \
curl \
libfreetype6-dev \
pkg-config \
software-properties-common \
unzip
# We don't install libnvinfer-dev since we don't need to build against TensorRT
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64/7fa2af80.pub && \
echo "deb https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu2004/x86_64 /" > /etc/apt/sources.list.d/tensorRT.list && \
apt-get update && \
apt-get install -y --no-install-recommends libnvinfer7=${TF_TENSORRT_VERSION}-1+cuda11.0 \
libnvinfer-plugin7=${TF_TENSORRT_VERSION}-1+cuda11.0 \
&& apt-get clean && \
rm -rf /var/lib/apt/lists/*;

28
requirements.txt Normal file
View File

@ -0,0 +1,28 @@
# Recomandation for noetic build
setuptools
numpy
pandas
scipy
sklearn
future
grpcio
h5py
requests
opencv-python
python-math
random2
pytest-warnings
os.path2
pydicom
glob2
pytest-shutil
DateTime
zipfile36
urllib3
tensorflow
keras==2.3.1
python-time
trimesh
librosa
gym