-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
98 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Docker | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'docker/**' | ||
workflow_dispatch: | ||
|
||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{github.repository}} | ||
|
||
jobs: | ||
docker: | ||
name: build (Ubuntu ${{matrix.ubuntu}}, OpenCV ${{matrix.opencv}}) | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
|
||
strategy: | ||
matrix: | ||
ubuntu: ['20.04', '22.04'] | ||
opencv: ['4.x'] | ||
|
||
steps: | ||
- name: Check out main project | ||
uses: actions/checkout@v4 | ||
|
||
- name: Log in to the Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{env.REGISTRY}} | ||
username: ${{github.actor}} | ||
password: ${{secrets.GITHUB_TOKEN}} | ||
|
||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{env.REGISTRY}}/${{env.IMAGE_NAME}} | ||
|
||
- name: Build and push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
context: docker | ||
tags: ${{env.REGISTRY}}/${{env.IMAGE_NAME}}:ubuntu-${{matrix.ubuntu}}-opencv-${{matrix.opencv}} | ||
labels: ${{steps.meta.outputs.labels}} | ||
build-args: | | ||
OPENCV_TAG=${{matrix.opencv}} | ||
UBUNTU_TAG=${{matrix.ubuntu}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
ARG UBUNTU_TAG | ||
FROM ubuntu:${UBUNTU_TAG} | ||
|
||
ARG OPENCV_TAG | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
g++ \ | ||
clang \ | ||
cmake \ | ||
wget \ | ||
unzip \ | ||
ccache \ | ||
libpcl-dev \ | ||
swig \ | ||
googletest && \ | ||
wget -O opencv.zip https://github.com/opencv/opencv/archive/${OPENCV_TAG}.zip && \ | ||
wget -O opencv_contrib.zip https://github.com/opencv/opencv_contrib/archive/${OPENCV_TAG}.zip && \ | ||
unzip opencv.zip && \ | ||
unzip opencv_contrib.zip && \ | ||
cmake -S opencv-${OPENCV_TAG} -B opencv-${OPENCV_TAG}/build \ | ||
-DOPENCV_EXTRA_MODULES_PATH=opencv_contrib-${OPENCV_TAG}/modules \ | ||
-DBUILD_TESTS=OFF \ | ||
-DBUILD_PERF_TESTS=OFF \ | ||
-DOPENCV_ENABLE_NONFREE=ON && \ | ||
cmake --build opencv-${OPENCV_TAG}/build && \ | ||
cmake --install opencv-${OPENCV_TAG}/build && \ | ||
rm -rf opencv.zip opencv_contrib.zip opencv-${OPENCV_TAG} opencv_contrib-${OPENCV_TAG} && \ | ||
apt-get clean |