ci: Linux and Windows uhd build docker images

This commit adds Pipeline support for building uhd toolchain docker
images. The Dockerfiles specify the required dependencies to build uhd.
These can then be used in downstream pipelines to build uhd. It's also
possible to use the Dockerfiles using "docker build" and "docker run"
to locally create the toolchain to build uhd.

Signed-off-by: Steven Koo <steven.koo@ni.com>
This commit is contained in:
Steven Koo 2021-03-09 13:25:11 -06:00 committed by Aaron Rossetto
parent 71f48df77e
commit 19f3c1203a
10 changed files with 492 additions and 0 deletions

View file

@ -0,0 +1,35 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
FROM fedora:32
LABEL maintainer="Ettus Research"
RUN dnf install -y \
boost-devel \
ccache \
cmake \
doxygen \
dpdk \
dpdk-devel \
dpdk-tools \
gcc \
gcc-c++ \
git \
libusb1-devel \
make \
ncompress \
ninja-build \
python3-devel \
python3-docutils \
python3-mako \
python3-numpy \
python3-pip \
python3-requests \
redhat-rpm-config \
rpm-build \
rpm-devel \
rsync \
tar \
xz \
&& \
dnf clean all

View file

@ -0,0 +1,35 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
FROM fedora:33
LABEL maintainer="Ettus Research"
RUN dnf install -y \
boost-devel \
ccache \
cmake \
doxygen \
dpdk \
dpdk-devel \
dpdk-tools \
gcc \
gcc-c++ \
git \
libusb1-devel \
make \
ncompress \
ninja-build \
python3-devel \
python3-docutils \
python3-mako \
python3-numpy \
python3-pip \
python3-requests \
redhat-rpm-config \
rpm-build \
rpm-devel \
rsync \
tar \
xz \
&& \
dnf clean all

View file

@ -0,0 +1,38 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
FROM ubuntu:18.04
LABEL maintainer="Ettus Research"
# This will make apt-get install without question
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install -q \
build-essential \
ccache \
curl \
git \
sudo \
# Install UHD dependencies
abi-dumper \
cmake \
doxygen \
dpdk \
libboost-all-dev \
libdpdk-dev \
libgps-dev \
libgps-dev \
libudev-dev \
libusb-1.0-0-dev \
ncompress \
ninja-build \
python3-dev \
python3-docutils \
python3-mako \
python3-numpy \
python3-pip \
python3-requests \
&& \
rm -rf /var/lib/apt/lists/*

View file

@ -0,0 +1,38 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
FROM ubuntu:20.04
LABEL maintainer="Ettus Research"
# This will make apt-get install without question
ARG DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install -q \
build-essential \
ccache \
curl \
git \
sudo \
# Install UHD dependencies
abi-dumper \
cmake \
doxygen \
dpdk \
libboost-all-dev \
libdpdk-dev \
libgps-dev \
libgps-dev \
libudev-dev \
libusb-1.0-0-dev \
ncompress \
ninja-build \
python3-dev \
python3-docutils \
python3-mako \
python3-numpy \
python3-pip \
python3-requests \
&& \
rm -rf /var/lib/apt/lists/*

View file

@ -0,0 +1,42 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
# This uses Window Server 2019 since it supports container jobs.
# This must match the Windows Server version that the Pipelines
# agent runs on. It's possible to switch out the base image
# with a Windows 10 image for local builds.
FROM mcr.microsoft.com/windows/servercore:1809
LABEL maintainer="Ettus Research"
RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
-NoProfile -InputFormat None -ExecutionPolicy Bypass \
-Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' --version=3.19.6
RUN choco install -y doxygen.install --version=1.9.1
RUN choco install -y git
RUN choco install -y NSIS --version=3.06.1
RUN choco install -y vim
RUN choco install -y python3 --version=3.7.9
RUN pip install mako requests numpy ruamel.yaml
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
Invoke-WebRequest "https://aka.ms/vs/15/release/vs_community.exe" \
-OutFile "%TEMP%\vs_community.exe" -UseBasicParsing
RUN "%TEMP%\vs_community.exe" --quiet --wait --norestart --noUpdateInstaller \
--add Microsoft.VisualStudio.Workload.NativeDesktop \
--add Microsoft.VisualStudio.Component.Windows81SDK \
--includeRecommended
RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m
RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
cd %VCPKG_INSTALL_DIR% && \
# The vcpkg git commit sets the toolchain dependenices
# This commit uses Boost 1.75 and libusb 1.0.24
git checkout 3426db05b996481ca31e95fff3734cf23e0f51bc && \
bootstrap-vcpkg.bat
RUN cd %VCPKG_INSTALL_DIR% && vcpkg install --clean-after-build \
libusb:x64-windows \
boost:x64-windows

View file

@ -0,0 +1,41 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
# This uses Window Server 2019 since it supports container jobs.
# This must match the Windows Server version that the Pipelines
# agent runs on. It's possible to switch out the base image
# with a Windows 10 image for local builds.
FROM mcr.microsoft.com/windows/servercore:1809
LABEL maintainer="Ettus Research"
RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
-NoProfile -InputFormat None -ExecutionPolicy Bypass \
-Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' --version=3.19.6
RUN choco install -y doxygen.install --version=1.9.1
RUN choco install -y git
RUN choco install -y NSIS --version=3.06.1
RUN choco install -y vim
RUN choco install -y python3 --version=3.7.9
RUN pip install mako requests numpy ruamel.yaml
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
Invoke-WebRequest "https://aka.ms/vs/15/release/vs_community.exe" \
-OutFile "%TEMP%\vs_community.exe" -UseBasicParsing
RUN "%TEMP%\vs_community.exe" --quiet --wait --norestart --noUpdateInstaller \
--add Microsoft.VisualStudio.Workload.NativeDesktop \
--add Microsoft.VisualStudio.Component.Windows81SDK \
--includeRecommended
RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m
RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
cd %VCPKG_INSTALL_DIR% && \
# The vcpkg git commit sets the toolchain dependenices
# This commit uses Boost 1.75 and libusb 1.0.24
git checkout 3426db05b996481ca31e95fff3734cf23e0f51bc && \
bootstrap-vcpkg.bat
RUN cd %VCPKG_INSTALL_DIR% && vcpkg install --clean-after-build \
libusb:x86-windows \
boost:x86-windows

View file

@ -0,0 +1,41 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
# This uses Window Server 2019 since it supports container jobs.
# This must match the Windows Server version that the Pipelines
# agent runs on. It's possible to switch out the base image
# with a Windows 10 image for local builds.
FROM mcr.microsoft.com/windows/servercore:1809
LABEL maintainer="Ettus Research"
RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
-NoProfile -InputFormat None -ExecutionPolicy Bypass \
-Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' --version=3.19.6
RUN choco install -y doxygen.install --version=1.9.1
RUN choco install -y git
RUN choco install -y NSIS --version=3.06.1
RUN choco install -y vim
RUN choco install -y python3 --version=3.7.9
RUN pip install mako requests numpy ruamel.yaml
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
Invoke-WebRequest "https://aka.ms/vs/16/release/vs_community.exe" \
-OutFile "%TEMP%\vs_community.exe" -UseBasicParsing
RUN "%TEMP%\vs_community.exe" --quiet --wait --norestart --noUpdateInstaller \
--add Microsoft.VisualStudio.Workload.NativeDesktop \
--includeRecommended
RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m
RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
cd %VCPKG_INSTALL_DIR% && \
# The vcpkg git commit sets the toolchain dependenices
# This commit uses Boost 1.75 and libusb 1.0.24
git checkout 3426db05b996481ca31e95fff3734cf23e0f51bc && \
bootstrap-vcpkg.bat
RUN cd %VCPKG_INSTALL_DIR% && vcpkg install --clean-after-build \
libusb:x64-windows \
boost:x64-windows

View file

@ -0,0 +1,40 @@
# please follow docker best practices
# https://docs.docker.com/engine/userguide/eng-image/dockerfile_best-practices/
# This uses Window Server 2019 since it supports container jobs.
# This must match the Windows Server version that the Pipelines
# agent runs on. It's possible to switch out the base image
# with a Windows 10 image for local builds.
FROM mcr.microsoft.com/windows/servercore:1809
LABEL maintainer="Ettus Research"
RUN @"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" \
-NoProfile -InputFormat None -ExecutionPolicy Bypass \
-Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; \
iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && \
SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"
RUN choco install -y cmake.install --installargs 'ADD_CMAKE_TO_PATH=System' --version=3.19.6
RUN choco install -y doxygen.install --version=1.9.1
RUN choco install -y git
RUN choco install -y NSIS --version=3.06.1
RUN choco install -y vim
RUN choco install -y python3 --version=3.7.9
RUN pip install mako requests numpy ruamel.yaml
RUN powershell -NoProfile -ExecutionPolicy Bypass -Command \
Invoke-WebRequest "https://aka.ms/vs/16/release/vs_community.exe" \
-OutFile "%TEMP%\vs_community.exe" -UseBasicParsing
RUN "%TEMP%\vs_community.exe" --quiet --wait --norestart --noUpdateInstaller \
--add Microsoft.VisualStudio.Workload.NativeDesktop \
--includeRecommended
RUN setx VCPKG_INSTALL_DIR "c:\\vcpkg" /m
RUN git clone https://github.com/microsoft/vcpkg %VCPKG_INSTALL_DIR% && \
cd %VCPKG_INSTALL_DIR% && \
# The vcpkg git commit sets the toolchain dependenices
# This commit uses Boost 1.75 and libusb 1.0.24
git checkout 3426db05b996481ca31e95fff3734cf23e0f51bc && \
bootstrap-vcpkg.bat
RUN cd %VCPKG_INSTALL_DIR% && vcpkg install --clean-after-build \
libusb:x86-windows \
boost:x86-windows

View file

@ -0,0 +1,179 @@
trigger:
branches:
include:
- master
paths:
include:
- .ci/docker
- .ci/uhd-build-docker-container.yml
pr:
branches:
include:
- master
paths:
include:
- .ci/docker
- .ci/uhd-build-docker-container.yml
variables:
- template: uhd-pipeline-vars.yml
- name: linuxDockerImages
value:
"{'Fedora-32-builder':{'dockerOSName':'fedora32','dockerImageName':'uhd-builder-fedora32'},
'Fedora-33-builder':{'dockerOSName':'fedora33','dockerImageName':'uhd-builder-fedora33'},
'Ubuntu-1804-builder':{'dockerOSName':'ubuntu1804','dockerImageName':'uhd-builder-ubuntu1804'},
'Ubuntu-2004-builder':{'dockerOSName':'ubuntu2004','dockerImageName':'uhd-builder-ubuntu2004'}}"
- name: winDockerImages
value:
"{'VS2017-x86-builder':{'dockerOSName':'win-vs17-v141-x86','dockerImageName':'uhd-builder-vs2017-v141-x86','cmakeCompiler':'Visual Studio 15 2017','cmakeArch':'Win32','vsArch':'x86','vsYear':'2017'},
'VS2017-x64-builder':{'dockerOSName':'win-vs17-v141-x64','dockerImageName':'uhd-builder-vs2017-v141-x64','cmakeCompiler':'Visual Studio 15 2017','cmakeArch':'x64','vsArch':'x64','vsYear':'2017'},
'VS2019-x86-builder':{'dockerOSName':'win-vs19-v142-x86','dockerImageName':'uhd-builder-vs2019-v142-x86','cmakeCompiler':'Visual Studio 16 2019','cmakeArch':'Win32','vsArch':'x86','vsYear':'2019'},
'VS2019-x64-builder':{'dockerOSName':'win-vs19-v142-x64','dockerImageName':'uhd-builder-vs2019-v142-x64','cmakeCompiler':'Visual Studio 16 2019','cmakeArch':'x64','vsArch':'x64','vsYear':'2019'}}"
- name: dockerImagePrefix
value: 'rfsdr/'
jobs:
- job: build_image_linux
displayName: Build Docker Image
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands:
- agent.os -equals Linux
- docker
strategy:
matrix: $[ variables.linuxDockerImages ]
steps:
- checkout: self
clean: true
- task: Docker@2
displayName: Build Image
inputs:
command: 'build'
Dockerfile: '$(Build.SourcesDirectory)/.ci/docker/$(dockerImageName).Dockerfile'
containerRegistry: 'Docker / Artifactory - rnd-builds-local'
repository: '$(dockerImagePrefix)$(dockerImageName)'
tags: $(Build.BuildNumber)
arguments: --no-cache --pull
- task: Docker@2
displayName: Push Image
inputs:
command: 'push'
containerRegistry: 'Docker / Artifactory - rnd-builds-local'
repository: '$(dockerImagePrefix)$(dockerImageName)'
tags: $(Build.BuildNumber)
- job: test_image_linux
displayName: Test Docker Image
dependsOn: build_image_linux
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands:
- agent.os -equals Linux
- docker
strategy:
matrix: $[ variables.linuxDockerImages ]
container:
image: '$(dockerImagePrefix)$(dockerImageName):$(Build.BuildNumber)'
endpoint: 'Docker / Artifactory - rnd-builds-local'
workspace:
clean: outputs
steps:
- checkout: self
clean: true
- script: |
cd $(Build.BinariesDirectory)
mkdir -p uhddev/build
cd uhddev/build
cmake $(Build.SourcesDirectory)/host
displayName: Test image with cmake uhd
- script: |
cd $(Build.BinariesDirectory)
mkdir -p uhddev/build-ninja
cd uhddev/build-ninja
cmake -G Ninja $(Build.SourcesDirectory)/host
displayName: Test image with cmake ninja uhd
- job: build_image_win
displayName: Build Docker Image Windows
timeoutInMinutes: 120
pool:
name: de-dre-lab
demands:
- agent.os -equals Windows_NT
- docker
strategy:
matrix: $[ variables.winDockerImages ]
maxParallel: 2
steps:
- checkout: self
clean: true
- task: Docker@2
displayName: Build Image
inputs:
command: 'build'
Dockerfile: '$(Build.SourcesDirectory)/.ci/docker/$(dockerImageName).Dockerfile'
containerRegistry: 'Docker / Artifactory - rnd-builds-local'
repository: '$(dockerImagePrefix)$(dockerImageName)'
tags: $(Build.BuildNumber)
arguments: --no-cache --pull
- task: Docker@2
displayName: Push Image
inputs:
command: 'push'
containerRegistry: 'Docker / Artifactory - rnd-builds-local'
repository: '$(dockerImagePrefix)$(dockerImageName)'
tags: $(Build.BuildNumber)
- job: test_image_win
displayName: Test Docker Image Windows
dependsOn: build_image_win
pool:
name: de-dre-lab
demands:
- agent.os -equals Windows_NT
- docker
strategy:
matrix: $[ variables.winDockerImages ]
container:
image: '$(dockerImagePrefix)$(dockerImageName):$(Build.BuildNumber)'
endpoint: 'Docker / Artifactory - rnd-builds-local'
workspace:
clean: outputs
steps:
- checkout: self
clean: true
- script: |
cd $(Build.BinariesDirectory)
mkdir uhddev\build
cd uhddev\build
cmake $(Build.SourcesDirectory)/host ^
-DCMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALL_DIR%\scripts\buildsystems\vcpkg.cmake ^
-G "$(cmakeCompiler)" -A $(cmakeArch)
displayName: Test image with cmake uhd
- script: |
cd $(Build.BinariesDirectory)
cd uhddev\build
"C:\Program Files (x86)\Microsoft Visual Studio\$(vsYear)\Community\VC\Auxiliary\Build\vcvarsall.bat" $(vsArch)
displayName: Load Visual C++ Env
- job: export_build_number
displayName: Export Image List to Artifacts
pool:
name: Drivers-NIBuildFarm-RFMIBUILD
demands: sh
steps:
- checkout: none
- script: |
cd $(Build.ArtifactStagingDirectory)
touch $(UHDPipelineDockerImageArtifactName)
echo "$(Build.BuildNumber)" > $(UHDPipelineDockerImageArtifactName)
echo "${{ variables.dockerImagePrefix }}" >> $(UHDPipelineDockerImageArtifactName)
echo "${{ variables.linuxDockerImages }}" >> $(UHDPipelineDockerImageArtifactName)
echo "${{ variables.winDockerImages }}" >> $(UHDPipelineDockerImageArtifactName)
displayName: Generate created image list
- task: PublishPipelineArtifact@1
inputs:
targetPath: $(Build.ArtifactStagingDirectory)
artifactName: $(UHDPipelineDockerImageArtifactName)
displayName: Upload image list artifact

View file

@ -0,0 +1,3 @@
variables:
- name: UHDPipelineDockerImageArtifactName
value: 'DockerImageNames'